std::mem_fu..._fun_ref_t,(3)
πΈ NAME πΈ
Okay bestie, manual-name check near the top: this is the C++ Standard Libary manual page for std::mem_fu..._fun_ref_t,(3). (The header really does spell it Libary β preserving the exact text, no notes.) The NAME line says std::mem_fun_ref_t,std::mem_fun1_ref_t,std::const_mem_fun_ref_t, - and then repeats std::mem_fun_ref_t,std::mem_fun1_ref_t,std::const_mem_fun_ref_t,. The synopsis below also brings in const_mem_fun1_ref_t, so yes, four wrapper class templates are in the group chat. β¨
β¨ Synopsis β¨
Defined in header <functional> β and here's the synopsis, copied exactly so the compiler gremlins don't come for us:
Defined in header <functional>
template< class S, class T >
class mem_fun_ref_t : public unary_function<T,S> {
public: (1)
(deprecated in C++11)
explicit mem_fun_ref_t(S (T::*p)());
(removed in C++17)
S operator()(T& p) const;
};
template< class S, class T >
class const_mem_fun_ref_t : public unary_function<T,S> {
public: (2)
(deprecated in C++11)
explicit const_mem_fun_ref_t(S (T::*p)() const);
(removed in C++17)
S operator()(const T& p) const;
};
template< class S, class T, class A >
class mem_fun1_ref_t : public binary_function<T,A,S> {
public: (3)
(deprecated in C++11)
explicit mem_fun1_ref_t(S (T::*p)(A));
(removed in C++17)
S operator()(T& p, A x) const;
};
template< class S, class T, class A >
class const_mem_fun1_ref_t : public binary_function<T,A,S>
{
(deprecated in C++11)
public: (4)
(removed in C++17)
explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
S operator()(const T& p, A x) const;
};
Okay so the plot: this whole family is a wrapper around a member function pointer. The class instance whose member function you're calling gets passed as a reference to operator(). That's the main character energy. The numbered versions map like this:
- Wraps a non-const member function with no parameters.
- Wraps a const member function with no parameters.
- Wraps a non-const member function with a single parameter.
- Wraps a const member function with a single parameter.
Heads up, bestie: the synopsis itself marks these(deprecated in C++11)and(removed in C++17). That is a real technical caveat, not just a vibe check. π
π«Ά See also π«Ά
mem_fun_refβ creates a wrapper from a pointer to member function, callable with a reference to object (function template). (deprecated in C++11) (removed in C++17)mem_fun_t,mem_fun1_t,const_mem_fun_t,const_mem_fun1_tβ wrapper for a pointer to nullary or unary member function, callable with a pointer to object (class template). (deprecated in C++11) (removed in C++17)
Source/version/date sign-off, straight from the footer: http://cppreference.com Β· 2024.06.10 Β· std::mem_fu..._fun_ref_t,(3) πβ¨π«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms