19.4.3. Using Member Functions as Callable Objects
As we’ve seen, to make a call through a pointer to member function, we must use the
->* operators to bind the pointer to a specific object. As a result, unlike ordinary function pointers, a pointer to member is not a callable object; these pointers do not support the function-call operator (§ 10.3.2, p. 388).
Because a pointer to member is not a callable object, we cannot directly pass a pointer to a member function to an algorithm. As an example, if we wanted to find the first empty
string in a
strings, the obvious call won’t work:
auto fp = &string::empty; // fp points to the string empty function// error: must use .* or ->* to call a pointer to memberfind_if(svec.begin(), ...