STD::MEM_FUN_T(3cxx)
π NAME π
std::mem_fun_t< _Ret, _Tp > β bestie, it's one of the adaptors for member pointers. That's the whole vibe. It wraps up a pointer-to-member-function so it can be called like a regular function object, and it's lowkey iconic for it.
Quick heads up: this here page lives in the 3cxx manual (that's the libstdc++ corner of the world), so if you see (3cxx) floating around, that's just where you are π
β¨ SYNOPSIS β¨
Okay so first things first, you gotta bring in the header or literally nothing works:
#include <functional>
And it Inherits std::unary_function< _Tp *, _Ret > β yes, it's giving family tree energy, that's where the typedefs come from π«Ά
πΈ Public Types πΈ
typedef _Tp * argument_typeβargument_typeis the type of the argument, no cap. It's a pointer to_Tp, periodt.typedef _Ret result_typeβresult_typeis the return type. That's it, that's the whole deal π
π¦ Public Member Functions π¦
mem_fun_t (_Ret(_Tp::*__pf)())β the constructor, takes a pointer to a member function of_Tpthat takes no args and hands back_Ret._Ret operator() (_Tp *__p) constβ the main character moment π you give it a_Tp *and it calls through, returning_Ret.
π Detailed Description π
template<typename _Ret, typename _Tp>
class std::mem_fun_t< _Ret, _Tp >
"One of the adaptors for member pointers." β that's the official word, and honestly? Accurate. It's the little wrapper that lets you treat a member function pointer like a plain callable. Chef's kiss π
Ngl the docs literally describe it as "One of the adaptors for member pointers" β so if you were expecting a novel, this is a short story, not a trilogy π
π§ Member Typedef Documentation π§
typedef _Tp * std::unary_function< _Tp * , _Ret >::argument_type
[inherited]
argument_type is the type of the argument. Inherited from the base, so you get it for free β slay π
typedef _Ret std::unary_function< _Tp * , _Ret >::result_type [inherited]
result_type is the return type. Also inherited, also free, also serving β¨
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. So like... nobody hand-wrote this, the robots did it π
Okay bestie that's the whole page β ily, go adapt some member pointers responsibly π
libstdc++ Β· std::mem_fun_t< _Ret, _Tp >(3cxx) β that's the source and version tag riding along at the bottom of the original, and I'm passing it to you with a lil forehead kiss π«Άπ
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms