STD::CONST_MEM_FUN1_T(3cxx)
π NAME
ok so bestie, meet std::const_mem_fun1_t< _Ret, _Tp, _Arg > β it's literally one of the adaptors for member pointers. that's the whole vibe. it takes a pointer-to-const-member-function and makes it behave like a regular callable object. slay.
(this is the <functional> girlies' territory, section 3cxx of the manual, if you're keeping track π)
β¨ SYNOPSIS β¨
first things first, you gotta let her in:
#include <functional>
and she inherits from std::binary_function< const _Tp *, _Arg, _Ret > β so everything that base class has? she's got it too. inherited, no cap. π
πΈ Public Types
typedef const _Tp * first_argument_typeβfirst_argument_typeis the type of the first argument. yes, it's aconst _Tp *. that asterisk is doing the heavy lifting fr.typedef _Ret result_typeβresult_typeis the return type._Retis the moment,_Retis the main character.typedef _Arg second_argument_typeβsecond_argument_typeis the type of the second argument._Arg, you're literally second in line but still iconic.
π¦ Public Member Functions
const_mem_fun1_t (_Ret(_Tp::*__pf)(_Arg) const)β the constructor, and its one job is holding onto a pointer to aconstmember function of_Tpthat takes one_Argand gives you back_Ret. that's it, that's the whole parameter. π_Ret operator() (const _Tp *__p, _Arg __x) constβ the call operator. hand her aconst _Tp *and an_Arg, she cashes in the stored member pointer and hands you back_Ret. this is the part where it all pays off, periodt.
π Detailed Description
template<typename _Ret, typename _Tp, typename _Arg>
class std::const_mem_fun1_t< _Ret, _Tp, _Arg >
the official tagline: "One of the adaptors for member pointers." short, sweet, gets straight to the point, we love her for it. π«
three template params, no more no less: _Ret (what comes back out), _Tp (the class the member lives on), _Arg (the one thing you feed it). that's the trio. iykyk.
π Member Typedef Documentation
π typedef const _Tp * std::binary_function< const _Tp * , _Arg , _Ret >::first_argument_type [inherited]
first_argument_type is the type of the first argument. inherited from std::binary_function< const _Tp * , _Arg , _Ret >, so, like, don't come for her for not declaring it herself. π
β typedef _Ret std::binary_function< const _Tp * , _Arg , _Ret >::result_type [inherited]
result_type is the return type. also inherited. also a legend.
π§ typedef _Arg std::binary_function< const _Tp * , _Arg , _Ret >::second_argument_type [inherited]
second_argument_type is the type of the second argument. third one, still carrying the team on inherited legs. we stan a consistent naming scheme. π
π Author
Generated automatically by Doxygen for libstdc++ from the source code. no human wrote this, it was the robots, and honestly? they ate. π€β¨
heads up bestie: this one's auto-generated documentation for libstdc++, i.e. the GNU C++ standard library. the wording is the compiler's, not mine β so if something looks terse, that's just the Doxygen aesthetic. π
ok that's the whole page!! thanks for reading, written from the libstdc++ source code, documented via Doxygen, section 3cxx β mwah, see u in the next man page π
ππ
π¦ 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