14 Feb
2005
14 Feb
'05
10:45 p.m.
Sharon Galtzur wrote:
Thanks for the reply. The thing i dont understand is this : template <class T> void f(int (T::*)(int)) will match any member function with specific signature (receiving int and returning int). But not all classes have such function. So in this case how will a class F { } be matched ?
No member of the given type need exist for the pointer-to-member type to be well-formed. Consider: struct C { }; typedef void (C::*mem_fun) (std::string); The later expression defines a type which can have no instances, but this doesn't prevent it from being used in a function declaration: void f(mem_fun mf); Jonathan