Returns a function object that encapsulates member function f of type T. The member function returns a value of type S and, optionally, can take one parameter of type A.

The function object returned by this function expects a reference to an object as its (first) argument for operator(). A similar function, mem_fun generates the same function but expecting a pointer to an object as (first) argument instead.

Function objects are objects whose class defines member function operator(). This member function allows the object to be used with the same syntax as a regular function call. Several standard algorithms and adaptors are designed to be used with function objects.

Template parameters

Parameters

f

Pointer to a member function, taking either one argument (of type A) or no arguments, and returning a value of type S.

Return value

A function object which calls the member function f of the object passed as its (first) argument.
If the member function accepts one parameter, this is specified as the second argument in the function object.