POINTER_ADAPTORS(3)
β¨ NAME β¨
Okay bestie, this is the Library Functions Manual page for Adaptors for pointers to functions β yes, the Adaptors f... functions(3) one β and it is literally giving pointer-glow-up realness π
β¨.
π Classes
class std::pointer_to_binary_function< _Arg1, _Arg2, _Result >β One of the adaptors for function pointers. Iconic.class std::pointer_to_unary_function< _Arg, _Result >β One of the adaptors for function pointers. Also iconic.
π Functions
- The binary one, fr fr:
template<typename _Arg1 , typename _Arg2 , typename _Result >
pointer_to_binary_function< _Arg1, _Arg2, _Result > std::ptr_fun
(_Result(*__x)(_Arg1, _Arg2))
- The unary one, no cap:
template<typename _Arg , typename _Result > pointer_to_unary_function<
_Arg, _Result > std::ptr_fun (_Result(*__x)(_Arg))
π Detailed Description π
The whole advantage of function objects over pointers to functions? Bestie, itβs that the objects in the standard library declare nested typedefs describing their argument and result types with uniform names β e.g., result_type from the base classes unary_function and binary_function. Sometimes those typedefs are required, not just optional. Periodt.
Adaptors are provided to turn pointers to unary (single-argument) and binary (double-argument) functions into function objects. The long-winded functor pointer_to_unary_function is constructed with a function pointer f, and its operator() called with argument x returns f(x). The functor pointer_to_binary_function does the same thing, but with a double-argument f and operator().
The function ptr_fun takes a pointer-to-function f and constructs an instance of the appropriate functor. Slay.
π₯ Function Documentation π₯
π template<typename _Arg1 , typename _Arg2 , typename _Result >
pointer_to_binary_function<_Arg1, _Arg2, _Result> std::ptr_fun
(_Result(*)(_Arg1, _Arg2) __x) [inline]
One of the adaptors for function pointers.
Definition at line 463 of file stl_function.h.
π template<typename _Arg , typename _Result >
pointer_to_unary_function<_Arg,
_Result> std::ptr_fun (_Result(*)(_Arg) __x) [inline]
One of the adaptors for function pointers.
Definition at line 437 of file stl_function.h.
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
Signed, sealed, slayed: libstdc++, dated 21 Apr 2009, for the Adaptors f... functions(3) page. Bye bestie, go adapt those pointers πβ¨ππ¦
π¦ where this page comes from
- nixpkgs unstable: std-man-pages 4.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms