#
The header provides partial specializations of function_ref for each combination of the possible replacements of the placeholders cv and noex where:

22.10.17.6.2 Class template function_ref [func.wrap.ref.class]

namespace std { template<class R, class. ArgTypes> class function_ref<R(ArgTypes..) cv noexcept(noex)> { public: / [func.wrap.ref.ctor], constructors and assignment operators template<class F> function_ref(F*) noexcept; template<class F> constexpr function_ref(F&&) noexcept; template<auto f> constexpr function_ref(constant_arg_t<f>) noexcept; template<auto f, class U> constexpr function_ref(constant_arg_t<f>, U&&) noexcept; template<auto f, class T> constexpr function_ref(constant_arg_t<f>, cv T*) noexcept; constexpr function_ref(const function_ref&) noexcept = default; constexpr function_ref& operator=(const function_ref&) noexcept = default; template<class T> function_ref& operator=(T) = delete; / [func.wrap.ref.inv], invocation R operator()(ArgTypes..) const noexcept(noex); private: template<class. T> static constexpr bool is-invocable-using = see below; / exposition only R (*thunk-ptr)(BoundEntityType, ArgTypes&&.) noexcept(noex); / exposition only BoundEntityType bound-entity; / exposition only }; / [func.wrap.ref.deduct], deduction guides template<class F> function_ref(F*) -> function_ref<F>; template<auto f> function_ref(constant_arg_t<f>) -> function_ref<see below>; template<auto f, class T> function_ref(constant_arg_t<f>, T&&) -> function_ref<see below>; }
1
#
An object of class function_ref<R(Args..) cv noexcept(noex)> stores a pointer to function thunk-ptr and an object bound-entity.
The object bound-entity has an unspecified trivially copyable type BoundEntityType, that models copyable and is capable of storing a pointer to object value or a pointer to function value.
The type of thunk-ptr is R(*)(BoundEntityType, Args&&.) noexcept(noex).
Each specialization of function_ref is a trivially copyable type ([basic.types.general]) that models copyable.
Within subclause [func.wrap.ref], call-args is an argument pack with elements such that decltype(call-args)). denote ArgTypes&&. respectively.

22.10.17.6.3 Constructors and assignment operators [func.wrap.ref.ctor]

template<class. T> static constexpr bool is-invocable-using = see below;
If noex is true, is-invocable-using<T..> is equal to: is_nothrow_invocable_r_v<R, T.., ArgTypes..>
Otherwise, is-invocable-using<T..> is equal to: is_invocable_r_v<R, T.., ArgTypes..>
template<class F> function_ref(F* f) noexcept;
Effects: Initializes bound-entity with f, and thunk-ptr with the address of a function thunk such that thunk(bound-entity, call-args..) is expression-equivalent ([defns.expression.equivalent]) to invoke_r<R>(f, call-args..).
template<class F> constexpr function_ref(F&& f) noexcept;
Effects: Initializes bound-entity with addressof(f), and thunk-ptr with the address of a function thunk such that thunk(bound-entity, call-args..) is expression-equivalent ([defns.expression.equivalent]) to invoke_r<R>(static_cast<cv T&>(f), call-args..).
template<auto f> constexpr function_ref(constant_arg_t<f>) noexcept;
Mandates: If is_pointer_v<F> || is_member_pointer_v<F> is true, then f != nullptr is true.
Effects: Initializes bound-entity with a pointer to an unspecified object or null pointer value, and thunk-ptr with the address of a function thunk such that thunk(bound-entity, call-args..) is expression-equivalent ([defns.expression.equivalent]) to invoke_r<R>(f, call-args..).
template<auto f, class U> constexpr function_ref(constant_arg_t<f>, U&& obj) noexcept;
Let T be remove_reference_t<U> and F be decltype(f).
Mandates: If is_pointer_v<F> || is_member_pointer_v<F> is true, then f != nullptr is true.
Effects: Initializes bound-entity with addressof(obj), and thunk-ptr with the address of a function thunk such that thunk(bound-entity, call-args..) is expression-equivalent ([defns.expression.equivalent]) to invoke_r<R>(f, static_cast<cv T&>(obj), call-args..).
template<auto f, class T> constexpr function_ref(constant_arg_t<f>, cv T* obj) noexcept;
Mandates: If is_pointer_v<F> || is_member_pointer_v<F> is true, then f != nullptr is true.
Preconditions: If is_member_pointer_v<F> is true, obj is not a null pointer.
Effects: Initializes bound-entity with obj, and thunk-ptr with the address of a function thunk such that thunk(bound-entity, call-args..) is expression-equivalent ([defns.expression.equivalent]) to invoke_r<R>(f, obj, call-args..).
template<class T> function_ref& operator=(T) = delete;
Constraints:
  • T is not the same type as function_ref,
  • is_pointer_v<T> is false, and
  • T is not a specialization of constant_arg_t.
R operator()(ArgTypes.. args) const noexcept(noex);
Effects: Equivalent to: return thunk-ptr(bound-entity, std​::​forward<ArgTypes>(args).);
template<class F> function_ref(F*) -> function_ref<F>;
Constraints: is_function_v<F> is true.
template<auto f> function_ref(constant_arg_t<f>) -> function_ref<see below>;
Remarks: The deduced type is function_ref<F>.
template<auto f, class T> function_ref(constant_arg_t<f>, T&&) -> function_ref<see below>;
Constraints:
  • F is of the form R(G​::​*)(A..) cv &
  • F is of the form M G​::​* for a type G and an object type M, in which case let R be invoke_result_t<F, T&>, A.. be an empty pack, and E be true, or
  • F is of the form R(*)(G, A..) noexcept(E) for a type G.
Remarks: The deduced type is function_ref<R(A..) noexcept(E)>.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant