Boost logo

Boost Users :

Subject: [Boost-users] [type traits / MPL] check whether a class has a certain member function
From: Stefan Strasser (strasser_at_[hidden])
Date: 2013-03-06 12:48:03


Hi,

I'm looking for a boost functionality to determine whether a given type
has a member function of a given name (or name + signature).
this seems to be possible using SFINAE, but all I can find is
BOOST_MPL_HAS_XXX_TRAIT_DEF which only works for nested types, not
functions.
I could of course implement it myself using SFINAE but
BOOST_MPL_HAS_XXX_TRAIT_DEF has a lot of compiler bug workarounds it
seems, so I guess this will cause problems. Is there such a
functionality in boost?

I want to use it to determine the defaults of a traits class, similar to
C++11 pointer_traits::difference_type. But the determining factor for
the default is a function in my case, not a type.

Thanks


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net