Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Function template mem_fn.

#include <boost/tr1/functional.hpp>

or

#include <functional>

std::tr1::mem_fn is a generalization of the standard functions std::mem_fun and std::mem_fun_ref. It supports member function pointers with more than one argument, and the returned function object can take a pointer, a reference, or a smart pointer to an object instance as its first argument. mem_fn also supports pointers to data members by treating them as functions taking no arguments and returning a (const) reference to the member. For more information refer to the Boost.Mem_fn documentation.

namespace std {
namespace tr1 {

template <class R, class T> unspecified mem_fn(R T::* pm);

} // namespace tr1
} // namespace std

Configuration: Boost.Config should (automatically) define the macro BOOST_HAS_TR1_MEM_FN if your standard library implements this part of TR1.

Standard Conformity: The Boost implementation does not produce functors that inherit from std::unary_function or std::binary_function, nor does it function correctly with pointers to volatile member functions (these should be extremely rare in practice however).


PrevUpHomeNext