15 Feb
2005
15 Feb
'05
4:58 p.m.
Jonathan Turkanis wrote:
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, <snip>
Actually it can:
struct D : C { void foo(std::string); };
mem_fun mf = static_cast