std::mem_fun (3) - Linux Manuals

std::mem_fun: std::mem_fun

NAME

std::mem_fun - std::mem_fun

Synopsis


Defined in header <functional>
template< class Res, class T > (1) (deprecated in C++11)
std::mem_fun_t<Res,T> mem_fun( Res (T::*f)() ); (removed in C++17)
template< class Res, class T > (1) (deprecated in C++11)
std::const_mem_fun_t<Res,T> mem_fun( Res (T::*f)() ); (removed in C++17)
template< class Res, class T, class Arg > (2) (deprecated in C++11)
std::mem_fun1_t<Res,T,Arg> mem_fun( Res (T::*f)(Arg) ); (removed in C++17)
template< class Res, class T, class Arg > (2) (deprecated in C++11)
std::const_mem_fun1_t<Res,T,Arg> mem_fun( S (T::*f)(Arg) ); (removed in C++17)


Creates a member function wrapper object, deducing the target type from the template arguments. The wrapper object expects a pointer to an object of type T as the first parameter to its operator().
1) Effectively calls std::mem_fun_t<S,T>(f) or std::const_mem_fun_t<S,T>(f).
2) Effectively calls std::mem_fun1_t<S,T>(f) or std::const_mem_fun1_t<S,T>(f).
This function and the related types were deprecated in C++11 and removed in C++17 in favor of the more general std::mem_fn and std::bind, both of which create callable adapter-compatible function objects from member functions.

Parameters


f - pointer to a member function to create a wrapper for

Return value


A function object wrapping f.

Exceptions


(none)

Notes


The difference between std::mem_fun and std::mem_fun_ref is that the former produces an function wrapper that expects a pointer to an object, whereas the latter -- a reference.

Example


 This section is incomplete
 Reason: no example

See also


mem_fun_ref creates a wrapper from a pointer to member function, callable with a reference to object
                      (function template)
(deprecated in C++11)
(removed in C++17)