Namespaces
Variants
Views
Actions

std::mem_fun_ref

From cppreference.com
< cpp‎ | utility‎ | functional
Revision as of 23:38, 31 May 2013 by P12bot (Talk | contribs)

 
 
 
Function objects
Function wrappers
(C++11)
(C++11)
Bind
(C++11)
Reference wrappers
(C++11)(C++11)
Operator wrappers
Negators
Deprecated binders and adaptors
(deprecated)
(deprecated)
(deprecated)
(deprecated)
(deprecated)(deprecated)(deprecated)(deprecated)
mem_fun_ref
(deprecated)
(deprecated)(deprecated)(deprecated)(deprecated)
(deprecated)(deprecated)
(deprecated)(deprecated)
 
Defined in header <functional>
template< class Res, class T >
std::mem_fun_ref_t<Res,T> mem_fun_ref( Res (T::*f)() );
(1) (deprecated)
template< class Res, class T >
std::const_mem_fun_ref_t<Res,T> mem_fun_ref( Res (T::*f)() );
(1) (deprecated)
template< class Res, class T, class Arg >
std::mem_fun1_ref_t<Res,T,Arg> mem_fun_ref( Res (T::*f)(Arg) );
(2) (deprecated)
template< class Res, class T, class Arg >
std::const_mem_fun1_ref_t<Res,T,Arg> mem_fun_ref( S (T::*f)(Arg) );
(2) (deprecated)

Creates a member function wrapper object, deducing the target type from the template arguments. The wrapper object expects a reference to an object of type T as the first parameter to its operator().

1) Effectively calls std::mem_fun_ref_t<S,T>(f) or std::const_mem_fun_ref_t<S,T>(f).

2) Effectively calls std::mem_fun1_ref_t<S,T>(f) or std::const_mem_fun1_ref_t<S,T>(f).

This function and the related types are deprecated as of C++11 in favor of the more general std::function and std::bind, both of which create callable adapter-compatible function objects from plain functions.

Contents

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

See also

(deprecated)
creates a wrapper from a pointer to member function, callable with a pointer to object
(function template) [edit]