I need help here to understand how enable_if could allow me to call a specialized method when a certain member exists in template class parameter.
I'm basically trying to come up with a portable __if_exists macro found only in Microsoft land.
I have this in header file:
template<class Primitive, class Contact, class ContactManager, int MAX_LEVELS>class A { BOOST_MPL_HAS_XXX_TRAIT_DEF(getFirstContact); [...] void foo(Primitive* p); void foo(Primitive* p, typename boost::enable_if<has_getFirstContact<Primitive> >::type *dummy=0);}
in the cpp file:
template<class Primitive, class Contact, class ContactManager, int MAX_LEVELS>voidA<Primitive, Contact, ContactManager, MAX_LEVELS>::foo(Primitive* p, typename boost::enable_if<has_getFirstContact<Primitive> >::type* dummy = 0){ ... }template<class Primitive, class Contact, class ContactManager, int MAX_LEVELS>voidA<Primitive, Contact, ContactManager, MAX_LEVELS>::foo(Primitive* p){ ... }
errors I'm getting in vc08:
[line in header file] error C2039: 'type' : is not a member of 'boost::enable_if<Cond>'
I'm probably missing a lot here...