An object of type std::function contains the called object . A pointer to a member function is a kind of called object; it can be called with an argument of the corresponding class type, as well as any additional arguments that it needs. For example:
struct S { void f(int); }; std::function<void(S, int)> g(&S::f);
To call it, pass an object of type S :
S s; g(s, 3);
Note that the std::function object has no S object; this is only when you call it so that the function pointer binds to the object.
Pete Becker Apr 01 '13 at 17:05 2013-04-01 17:05
source share