class template
<functional>

std::const_mem_fun_t

template <class S, class T> class const_mem_fun_t;
Generate function object class from const parameterless member (pointer version)
Generates an unary function object class from a constant parameterless member of class T that returns a value of type S.

const_mem_fun_t is generally used as a type. The function mem_fun (also defined in header <functional>) can be used to directly construct an object of this type.

This class is derived from unary_function and is typically defined as:

1
2
3
4
5
6
7
8
9
template <class S, class T>
  class const_mem_fun_t : public unary_function <T*,S>
{
  S (T::*pmem)() const;
public:
  explicit const_mem_fun_t ( S (T::*p)() const ) : pmem (p) {}
  S operator() (T* p) const
    { return (p->*pmem)(); }
};

Members

constructor
Constructs an unary function object class from constant member function p of class T. The return type of this member function shall be type compatible with type S.
S operator() (T* p) const
Member function taking one parameter. The argument expected for it is a pointer to an object of type T whose constant member is to be called.

See also