Name

const_mem_fun_ref_t class template — Calls a member function of a constant reference object

Synopsis

template <typename Rtn, typename T>
class const_mem_fun_ref_t : public unary_function<T, Rtn>
{
public:
  explicit const_mem_fun_ref_t(Rtn (T::*p)(  ) const);
  Rtn operator(  )(const T& p) const;
};

The const_mem_fun_ref_t class template is a unary functional that wraps a member function pointer. The Rtn template parameter is the member function’s return type, and the T template parameter is the class that declares the member function. The argument to the constructor is a pointer to the member function, which takes no arguments. The member function is called from operator( ) using a reference to the const object.

See the mem_fun_ref function template for an easier way to construct and use the const_mem_fun_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.