std::function_ref(3)
π std::function_ref π
okay bestie, this is std::function_ref(3), straight outta the C++ Standard Libary manual π the manual name is folded in right here so we don't have to do a boring header copy. It's giving class-template energy, and we're gonna get into every single detail. periodt.
πΈ NAME πΈ
std::function_ref β literally std::function_ref, no cap.
β¨ Synopsis β¨
Defined in header <functional>
template< class... > (1) (since C++26)
class function_ref; // not defined
template< class R, class... Args >
class function_ref<R(Args...)>;
template< class R, class... Args >
class function_ref<R(Args...) noexcept>; (2) (since C++26)
template< class R, class... Args >
class function_ref<R(Args...) const>;
template< class R, class... Args >
class function_ref<R(Args...) const noexcept>;
Class template std::function_ref is a non-owning function wrapper. std::function_ref objects can store and invoke a reference to a Callable target β functions, lambda expressions, bind expressions, or other function objects β but not pointers to member functions and pointers to member objects. std::nontype can be used to construct std::function_ref by passing function pointers, pointers to member functions, and pointers to member objects.
std::function_refs supports every possible combination of cv-qualifiers, and noexcept-specifiers not including volatile, provided in its template parameter.
Every specialization of std::function_ref is a TriviallyCopyable type that satisfies copyable. slay.
π Member objects π
Member name β Definition, because we're being thorough bestie:
bound-entity(private) β an object that has an unspecifiedTriviallyCopyabletypeBoundEntityType, that satisfiescopyableand is capable of storing a pointer to object value or pointer to function value (exposition-only member object*).thunk-ptr(private) β a pointer to function of typeR(*)(BoundEntityType, Args&&...) noexcept(/*noex*/)where/*noex*/is true if noexcept is present in function signature as part of the template parameter ofstd::function_ref(exposition-only member object*).
π Member functions π
constructorβ constructs a newfunction_refobject (C++26) (public member function).operator=β assigns afunction_ref(C++26) (public member function).operator()β invokes the stored thunk of afunction_ref(C++26) (public member function).
π¦ Deduction guides π¦
Deduction guides, bestie β¨
β Notes β
- Feature-test macro:
__cpp_lib_function_refβ Value:202306L; Std:(C++26); Feature:std::function_ref.
π Example π
This section is incomplete.
Reason: example.
π«Ά See also π«Ά
functionβ wraps callable object of any copy constructible type with specified function call signature (C++11) (class template).copyable_functionβ refinement ofstd::move_only_functionthat wraps callable object of any copy constructible type (C++26) (class template).move_only_functionβ wraps callable object of any type with specified function call signature (C++23) (class template).nontypeβ value construction tag.nontype_tβ(tag)(C++26).
π§ Category π§
- Todo with reason
xoxo, sourced from http://cppreference.com, dated 2024.06.10, page std::function_ref(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