Name

mem_fun1_ref_t class template — Calls a member function of a constant reference object with an argument

Synopsis

template <typename Rtn, typename T, typename Arg>
class mem_fun1_ref_t :
  public binary_function<T, Arg, Rtn>
{
public:
  explicit mem_fun1_ref_t(Rtn (T::*p)(Arg) const);
  Rtn operator(  )(const T& p, Arg x) const;
};

The mem_fun1_ref_t class template is a binary functional that wraps a member function pointer. The Rtn template parameter is the member function’s return type, the T template parameter is the class that declares the member function, and the Arg template parameter is the type of the member function’s sole argument.

The argument to the constructor is a pointer to the member function. The member function is called from operator( ) using a const reference to the object.

See the mem_fun_ref function template for an easier way to construct and use the mem_fun1_ref_t class template.

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.