
On Mon, Feb 13, 2012 at 11:08 AM, Frank Birbacher <bloodymir.crap@gmx.net>wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi!
Am 12.02.12 17:37, schrieb Mathias Gaunard:
And that meta-function is just
template<class F> struct function_type : remove_pointer<decltype(&F::operator())> { };
Well, that does not work for the following reason (example code below):
"The same type as T, but with any pointer modifier removed. Note that pointers to members are left unchanged: removing the pointer decoration would result in an invalid type." (see:
http://www.boost.org/doc/libs/1_48_0/libs/type_traits/doc/html/boost_typetra... )
So this is the point: I need a signature from a member function. There is no type trait that does this. Any other suggestions?
[...] Boost.FunctionTypes + Boost.MPL? Something like typename boost::function_types::function_type< typename boost::mpl::push_front< typename boost::function_types::result_type<F>::type, typename boost::mpl::pop_front< typename boost::function_types::parameter_types<F>::type >::type >::type
::type
or define a metafunction that converts a pointer-to-member-function type to the desired function type for some spectrum of arities: template< class F > struct member_function_to_function; template< class R, class T > struct member_function_to_function< R (T::*)()
{ typedef R type(); }; template< class R, class T > struct member_function_to_function< R (T::*)() const > { typedef R type(); }; // etc...up to some maximum arity
- Jeff