# std::mem_fun_t, std::mem_fun1_t, std::const_mem_fun_t, std::const_mem_fun1_t

> C++ Atlas: `cppatlas.com/w/cpp/utility/functional/mem_fun_t` | Source: https://en.cppreference.com/w/cpp/utility/functional/mem_fun_t | Domain: Utility | Standards: C++11, C++17

Wrapper around a member function pointer. The class instance whose member function to call is passed as a pointer to the operator().

## Official Specification Summary (cppreference)

```cpp
// Defined in header <functional>

template< class S, class T >
class mem_fun_t : public unary_function<T*,S> {
public:
    explicit mem_fun_t(S (T::*p)());
    S operator()(T* p) const;
}; // (1) (deprecated in C++11) (removed in C++17)

template< class S, class T >
class const_mem_fun_t : public unary_function<const T*,S> {
public:
    explicit const_mem_fun_t(S (T::*p)() const);
    S operator()(const T* p) const;
}; // (2) (deprecated in C++11) (removed in C++17)

template< class S, class T, class A >
class mem_fun1_t : public binary_function<T*,A,S> {
public:
    explicit mem_fun1_t(S (T::*p)(A));
    S operator()(T* p, A x) const;
}; // (3) (deprecated in C++11) (removed in C++17)

template< class S, class T, class A >
class const_mem_fun1_t : public binary_function<const T*,A,S> {
public:
    explicit const_mem_fun1_t(S (T::*p)(A) const);
    S operator()(const T* p, A x) const;
}; // (4) (deprecated in C++11) (removed in C++17)
```

Wrapper around a member function pointer. The class instance whose member function to call is passed as a pointer to the `operator()`.

1) Wraps a non-const member function with no parameters.

2) Wraps a const member function with no parameters.

3) Wraps a non-const member function with a single parameter.

4) Wraps a const member function with a single parameter.

### See also

- [`mem_fun`](https://en.cppreference.com/w/cpp/utility/functional/mem_fun) (deprecated in C++11): creates a wrapper from a pointer to member function, callable with a pointer to object (function template)
- [`mem_fun_ref_t`](https://en.cppreference.com/w/cpp/utility/functional/mem_fun_ref_t) (deprecated in C++11), [`mem_fun1_ref_t`](https://en.cppreference.com/w/cpp/utility/functional/mem_fun_ref_t) (removed in C++17), [`const_mem_fun_ref_t`](https://en.cppreference.com/w/cpp/utility/functional/mem_fun_ref_t), [`const_mem_fun1_ref_t`](https://en.cppreference.com/w/cpp/utility/functional/mem_fun_ref_t): wrapper for a pointer to nullary or unary member function, callable with a reference to object (class template)

---
Attribution: content from https://en.cppreference.com/w/cpp/utility/functional/mem_fun_t (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.