Boost logo

Boost Users :

Subject: Re: [Boost-users] [type traits / MPL] check whether a class has a certain member function
From: Stefan Strasser (strasser_at_[hidden])
Date: 2013-03-07 08:44:14


Am 07.03.2013 04:58, schrieb Edward Diener:
>> The macro you're looking for is BOOST_TTI_HAS_MEMBER_FUNCTION.
>> However, I don't think this has been released yet. It's in the
>> trunk, but I don't see it in the release branch.
>
> I am fairly close to finishing my work with TTI, but it is not yet in
> release.
>

Thanks, it works as advertised.

However, it requires you to know the exact signature of the member
function. I'm trying to check whether it is ok to call c.f(x), which
would be satisfied by each of the following 3 signatures (and more):

struct C{
     void f(X);
     void f(X &);
     void f(X const &);
     ...
};

is there a way to check for that, or do I have to check for all (likely)
signatures?
there is a way to check whether a function call is ok without knowing
the signature using c++11:

http://stackoverflow.com/questions/11273184/sfinae-member-function-existence-test-issue

I'm not sure if you can do the same in c++03.

Stefan


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