
Le 20/04/13 11:15, Antony Polukhin a écrit :
2013/4/20 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>:
Would it be preferable to add BOOST_STATIC_CONSTANT_11 and change every use of BOOST_STATIC_CONSTANT by BOOST_STATIC_CONSTANT_11 and deprecate BOOST_STATIC_CONSTANT? I would rather change the definitioon of BOOST_STATIC_CONSTANT to
# ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } # else # define BOOST_STATIC_CONSTANT(type, assignment) static *BOOST_CONSTEXPR_OR_CONST* type assignment # endif
Code from example:
template <typename T> const bool trait::value;
newer was correct, because compilers with BOOST_NO_INCLASS_MEMBER_INITIALIZATION define it to enum. So proposed change shall not break correct code.
Humm, I had made the change in BOOST_STATIC_CONSTANT and I'm getting error for example in namespace boost { namespace type_traits { template <int b1, int b2> struct ice_eq { BOOST_STATIC_CONSTANT(bool, value = (b1 == b2)); }; template <int b1, int b2> struct ice_ne { BOOST_STATIC_CONSTANT(bool, value = (b1 != b2)); }; #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION template <int b1, int b2> bool const ice_eq<b1,b2>::value; // ********* template <int b1, int b2> bool const ice_ne<b1,b2>::value; // ********* #endif for which I have needed to change const by BOOST_CONSTEXPR_OR_CONST. darwin.compile.c++ ../../../bin.v2/libs/config/test/math_info.test/darwin-4.8.0x/debug/math_info.o In file included from ../../../boost/type_traits/ice.hpp:18:0, from ../../../boost/type_traits/is_reference.hpp:18, from ../../../boost/type_traits/intrinsics.hpp:206, from ../../../boost/type_traits/alignment_of.hpp:15, from math_info.cpp:24: ../../../boost/type_traits/detail/ice_eq.hpp:29:53: erreur: redeclaration ‘boost::type_traits::ice_eq<b1, b2>::value’ differs in ‘constexpr’ template <int b1, int b2> bool const ice_eq<b1,b2>::value; ^ What am I missing? Best, Vicente