
17 Nov
2008
17 Nov
'08
9:35 a.m.
Joel Falcou wrote:
Eric Niebler a écrit :
Well, they're defined in the boost::proto::tag namespace. You can play tricks with ADL and sizeof....
Care to elaborate a few ?
Something like this: namespace boost { namespace proto { namespace tag { template<typename T> char check_is_proto_tag(T); }}} namespace not_proto { char (&check_is_proto_tag(...))[2]; } using not_proto::check_is_proto_tag; template<typename T> struct is_proto_tag : boost::mpl::bool_<sizeof(check_is_proto_tag(T()))==1> {}; struct not_proto_tag {}; BOOST_MPL_ASSERT((is_proto_tag<boost::proto::tag::plus>)); BOOST_MPL_ASSERT_NOT((is_proto_tag<not_proto_tag>)); -- Eric Niebler BoostPro Computing http://www.boostpro.com