Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2003-09-10 07:10:12


> I think I haven't made myself clear enough. enable_if
> controls whether a given function enters (or not) into the overload
> resolution set of a function name for a given type.
> What I'm talking about is an utility that determines
> if a certain member function of a type does exist. Something like
>
> has_mem_fn<T,void (T::*)(T&), &T::swap>::type
>
> evaluating to true iff T has such a swap method. As I'm writing this,
> seems to me this could only be achieved with some macro
> machinery.

Correct, one would have to define a macro that generated the template
meta-function specifically for the member function you're testing for, I was
just so surprised that this was actually possible that I just had to post
what seemed like a semi-obvious solution to the swap issue.

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk