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_type is the type of the argument, no cap. It's a pointer to _Tp, periodt.
  • typedef _Ret result_type β€” result_type is 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 _Tp that 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