#include #include #include #define TRAIT_HAS_NAMED(trait) \ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(BOOST_PP_CAT(has_, trait), trait, false) namespace mpl = boost::mpl; namespace tag { struct foo { struct foo_tag; }; } TRAIT_HAS_NAMED(foo_tag) template struct foo; template struct foo >::type > { foo(); }; // definition template foo >::type >::foo() { } int main() { foo f; return 0; }