Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-02-14 17:45:35


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net