Boost logo

Boost :

Subject: Re: [boost] member function traits (was: Concept Traits Library)
From: John Maddock (boost.regex_at_[hidden])
Date: 2010-07-13 07:16:43


> and especially related to the function_traits of the type_traits library.
> Is there any interest in class member function introspection?

It's been asked for before but I haven't got around to it:
https://svn.boost.org/trac/boost/ticket/2011

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

The advantage is that remove_member_pointer is a pretty simple trait, useful
in it's own right, and then we don't need to mess with function_traits.

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.

Hope that makes sense, John.


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