[mpl] BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF

#include <iostream> #include <boost/mpl/has_xxx.hpp> #include <boost/mpl/bool.hpp> BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_xxx, xxx, false) struct test1 { int xxx; }; using namespace boost::mpl; int main() { std::cout<< has_xxx<test1>::value <<std::endl; return 0; } The output is 0, while it should be 1, shouldn't it? Rds,

Hicham Mouline wrote:
#include <iostream> #include <boost/mpl/has_xxx.hpp> #include <boost/mpl/bool.hpp>
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_xxx, xxx, false)
struct test1 { int xxx; };
using namespace boost::mpl; int main() { std::cout<< has_xxx<test1>::value <<std::endl; return 0; }
The output is 0, while it should be 1, shouldn't it?
That macro generates a trait that looks for a nested *type* with the specified name. In your case, xxx is a data member, not a type. HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Hicham Mouline