// reallyHas<std::string (C::*)(), &C::serialize> should be substituted by
// reallyHas<std::string (C::*)(), std::string (C::*)() &C::serialize> and work!
the above lines really get me,ok so we are calling reallyHas with the template arguments<std::string (C::*)(), &C::serialize>,I understand where he gets string from but what is (C::*)(),it looks like a function pointer but I don't think it is,
std::string (C::*) is a pointer to a non-static member function of class C that accepts no parameters and returns an std::string. std::string (C::*)() is a function (or callable. I'm unsure) that returns a pointer of the aforementioned type.
std::string (C::*)() is the type of a pointer-to-member-function of class C returning std::string and accepting no arguments. std::string (C::*) is just nonsense the type of a std::string data member of class C, with extraneous parentheses.
To define a function named f accepting int and returning a pointer-to-member function of class C returning std::string and accepting no arguments, you'd write std::string (C::*f(int))() { return &C::member; }, to be used like (c.*f(42))();
My previous post was mainly in response to what helios said.
When it comes to pointers to member functions the first set of parentheses are necessary for it to parse correctly. The second pair of parentheses contains the list of parameter types.
std::string (C::*)() is a pointer to a member function of class C that takes no arguments and returns a std::string.
std::string (C::*)(int) is a pointer to a member function of class C that takes one argument of type int and returns a std::string.
int (*p)(void*,void*) would be a function pointer to a function that returns an int and accepts two void pointers as arguments
std::string (C::*)() as you mentioned is pretty much a function pointer to a member function of class C that takes no arguments and returns a std::string
we can assign p the first function pointer to a function with p = &function
but how can we use the second one when it doesn't even have a name