|
Boost Users : |
From: nagual (nagual_at_[hidden])
Date: 2003-10-04 15:09:53
Hello, All!
I write simple code:
=============mpl_enum.cpp=============
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/for_each.hpp>
#include <iostream>
enum test_e {ONE, TWO, THREE};
void f(test_e e) {
const char* names[] = {"ONE", "TWO", "THREE"};
std::cout<<names[e]<<std::endl;
}
typedef boost::mpl::range_c<
test_e, ONE, static_cast<test_e>(THREE + 1)
> range;
int main() {
boost::mpl::for_each<range>(f);
return 0;
}
=============mpl_enum.cpp=============
MSVC 7 (ver 13.00.9466)
=============Command Line==============
c:\cl /EHsc /GR /Zc:wchar_t /Zc:forScope /nologo mpl_enum.cpp
=============Command Line==============
=============Output=====================
mpl_enum.cpp
C:\Lang\Projects\boost\boost\mpl\aux_\integral_wrapper.hpp(78) : error
C2440: 'return' : cannot convert from '' to 'test_e'
Conversion to enumeration type requires an explicit cast
(static_cast, C-style cast or function-style cast)
C:\Lang\Projects\boost\boost\mpl\aux_\integral_wrapper.hpp(78) :
while compiling class-template member function
'boost::mpl::integral_c<T,N>::operator`T'(void) const'
with
[
T=test_e,
N=ONE
]
C:\Lang\Projects\boost\boost\mpl\aux_\range_c\iterator.hpp(34) : see
reference to class template instantiation 'boost::mpl::integral_c<T,N>'
being compiled
with
[
T=test_e,
N=ONE
]
C:\Lang\Projects\boost\boost\mpl\for_each.hpp(70) : see reference to
class template instantiation 'boost::mpl::range_c_iterator<N>' being
compiled
with
[
N=boost::mpl::range_c<test_e,ONE,3>::start
]
C:\Lang\Projects\boost\boost\mpl\for_each.hpp(101) : see reference
to function template instantiation 'void
boost::mpl::aux::for_each_impl<done>::execute(Iterator *,last *,transform_op
*,void (__cdecl *)(test_e))' being compiled
with
[
done=false,
Iterator=first
]
C:\Lang\Projects\boost\boost\mpl\for_each.hpp(111) : see reference
to function template instantiation 'void boost::mpl::for_each(F,range
*,boost::mpl::identity<T> *)' being compiled
with
[
F=void (__cdecl *)(test_e),
T=boost::mpl::void_
]
mpl_enum.cpp(15) : see reference to function template instantiation
'void boost::mpl::for_each(F,range *)' being compiled
with
[
F=void (__cdecl *)(test_e)
]
=============Output=====================
However gcc v3.2.3, icl v 7.1, bcc32 v5.6.4 compile it.
(bcc32 show 3 equivalent warning).
How use it in MSVC 7?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net