On 02/02/2011 08:23, Frédéric Bron wrote:
Could it be a problem of line ending (windows/linux)? Could you try with that version: http://www.boostpro.com/vault/index.php?action=downloadfile&filename=type_traits-dos.tar.bz2&directory=Extension&
I just tried and it gives the same error. Actually it seems MSVC doesn't like "not", "or" and "and" : replacing them with "!", "||" and "&&" makes the error (and the warning) go away. However next, the following code : BOOST_STATIC_ASSERT(( boost::has_operator_left_shift< int, int
::value ));
Yields the rather non-informative error :
..... the code ..... : error C4430: missing type specifier - int
assumed. Note: C++ does not support default-int
(yes that's the only line in the error trace...)
And :
BOOST_STATIC_ASSERT(( boost::has_operator_left_shift< std::ostream,
int >::value ));
Adds a warning on top of the same error :
boost/type_traits/detail/has_binary_operator.hpp(106) : warning C4913:
user defined binary operator ',' exists but no overload could convert
all operands, default built-in binary operator ',' used
boost/type_traits/detail/has_binary_operator.hpp(142) : see
reference to class template instantiation
'boost::detail::has_operator_left_shift_impl::has_operator_left_shift_impl
However it doesn't work with a pointer type, for instance this fails : BOOST_STATIC_ASSERT(( boost::has_operator_left_shift< std::ostream, void*::value )); Can you say what you mean by it doesn't work? Do you mean compile error or returns the wrong value?
Sorry, I meant the assertion fails. Another case which doesn't compile however is : struct convertible_ambiguous { operator int() const; operator float() const; }; BOOST_STATIC_ASSERT(( boost::has_operator_left_shift< std::ostream, convertible_ambiguous >::value )); Thanks ! MAT.