Is it possible to get the constituents of a member function such as class type or return type just from its address (not from member function type) ?
For e.g. given
class foo
{
int bar()
{
return 5;
}
};
i like to have
is_same< function_types<&foo::bar>::class_type, foo>::value == true;
I also know additionally that the member function has a signature like R (C::*)() i.e no arguments and no cv-qualification.
Thank you.
In C++ pre-0x, you can’t do this very easily. In C++0x, you can use a combination of template functions and decltype to do this:
And then expand the above out for as high an arity as you need.