
If there's already a boost solution for this, then I have egg on my face, but I can't find one: I'd like an MPL macro that defines a predicate template which inherits from boost::true_type iff the given type defines *any* member with a particular name (false_type otherwise), and which does not assume the member name exists, like this: struct my_class { // foo might be member data, member function, a typedef, etc: int foo; }; CREATE_MEMBER_CHECK(foo); CREATE_MEMBER_CHECK(bar); has_member_foo<my_class> t1; // this inherits from true_type has_member_bar<my_class> t2; // this inherits from false_type I wrote an implementation of the above, and example, here: https://gist.github.com/erikerlandson/7251015 The macro BOOST_MPL_HAS_XXX_TRAIT_DEF produces a predicate class that detects if a nested type exists, but only works for types, not other kinds of defined members. The class is_member_pointer<T>, but appears to require that you already know a symbol exists. I suppose such a macro might be called BOOST_MPL_HAS_XXX_MEMBER_DEF.