Boost logo

Boost :

Subject: Re: [boost] member function traits (was: Concept Traits Library)
From: Barend Gehrels (barend_at_[hidden])
Date: 2010-07-13 08:10:36


Hi John,

Thanks for your quick answer.

John Maddock wrote:
>
> I think a separate traits class for extracting the member type from a
> pointer to member is the best solution here, lets say it's called
> "remove_member_pointer" (finding a good name is the main stumbling
> block really), then you could use:
>
> function_traits<typename
> remove_member_pointer<member_function_type>::type>::arity etc

O yes, that would be a good solution too. I'm interested in it.

>
> BTW the problem with extending function_traits is that it operates on
> function-types, and not on pointers or references to functions, but
> there is no such type as a "member function", only a pointer to one,
> so we would end up with different behaviors for member functions and
> regular ones.
Well, in my view the behaviour would be equal, but they would require
just some additional specializations (plus the trick to avoid add_pointer).

Actually I don't exactly see why function_traits should not operate on
pointers. The function_traits_helper operates on pointers and not on
types. So what actually happens is that the user removes the pointer,
and it is then added in the function_traits, and specialized on in the
details. No problem of course, but you could specialize on
function-types AND function-pointers separately to avoid the requirement
of using remove_pointer.

But, again, a remove_member_pointer, if it can be implemented, would do.
Is it already implemented or drafted somewhere? Because we cannot wait
to use it ;-)

Regards, Barend


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