libstdc++
std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)> Class Template Reference

Public Member Functions

template<typename _Fn >
requires is_function_v< _Fn > &&__is_invocable_using< _Fn * > function_ref (_Fn *__fn) noexcept
 
template<auto __fn>
requires constexpr __is_invocable_using< const decltype(__fn)& > function_ref (nontype_t< __fn >) noexcept
 
template<auto __fn, typename _Td >
requires constexpr __is_invocable_using< const decltype(__fn)&, _Td _GLIBCXX_MOF_CV * > function_ref (nontype_t< __fn >, _Td _GLIBCXX_MOF_CV *__ptr) noexcept
 
_Td _GLIBCXX_MOF_CV &constexpr function_ref (nontype_t< __fn >, _Up &&__ref) noexcept
 
_Res operator() (_ArgTypes... __args) const noexcept(_Noex)
 
template<auto __fn, typename _Up , typename _Td = remove_reference_t<_Up>>
 requires (!is_rvalue_reference_v< _Up && >) &&__is_invocable_using< const decltype(__fn) &
 
template<typename _Tp >
 requires (!is_same_v< _Tp, function_ref >) &&(!is_pointer_v< _Tp >) &&(!__is_nontype_v< _Tp >) function_ref &operator
 
template<typename _Fn , typename _Vt = remove_reference_t<_Fn>>
 requires (!is_same_v< remove_cv_t< _Vt >, function_ref >) &&(!is_member_pointer_v< _Vt >) &&(!is_function_v< _Vt >) &&__is_invocable_using< _Vt _GLIBCXX_MOF_CV & > const expr function_ref(_Fn &&__f) noexcept
 

Detailed Description

template<typename _Res, typename... _ArgTypes, bool _Noex>
class std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>

Non-owning polymorphic function wrapper.

Since
C++26

The std::function_ref class template is a non-owning call wrapper, that refers to a bound object. Using function_ref outside of the lifetime of the bound object has undefined behavior.

It supports const-qualification and no-throw guarantees. The qualifications and exception-specification of the signature are respected when invoking the reference function.

Definition at line 68 of file funcref_impl.h.

Constructor & Destructor Documentation

◆ function_ref() [1/3]

template<typename _Res , typename... _ArgTypes, bool _Noex>
template<typename _Fn >
requires is_function_v<_Fn>&& __is_invocable_using<_Fn*> std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::function_ref ( _Fn *  __fn)
inlinenoexcept

Target and bound object is function pointed by parameter.

Definition at line 89 of file funcref_impl.h.

◆ function_ref() [2/3]

template<typename _Res , typename... _ArgTypes, bool _Noex>
template<auto __fn>
requires constexpr __is_invocable_using<const decltype(__fn)&> std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::function_ref ( nontype_t< __fn >  )
inlineconstexprnoexcept

Target object is __fn. There is no bound object.

Definition at line 132 of file funcref_impl.h.

◆ function_ref() [3/3]

template<typename _Res , typename... _ArgTypes, bool _Noex>
template<auto __fn, typename _Td >
requires constexpr __is_invocable_using<const decltype(__fn)&, _Td _GLIBCXX_MOF_CV*> std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::function_ref ( nontype_t< __fn >  ,
_Td _GLIBCXX_MOF_CV *  __ptr 
)
inlineconstexprnoexcept

Target object is equivalent to std::bind_front<_fn>(__ptr). Bound object is object pointed by second parameter (if any).

Definition at line 168 of file funcref_impl.h.

Member Function Documentation

◆ operator()()

template<typename _Res , typename... _ArgTypes, bool _Noex>
_Res std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::operator() ( _ArgTypes...  __args) const
inlinenoexcept

Invoke the target object.

The bound object will be invoked using the supplied arguments, and as const or non-const, as dictated by the template arguments of the function_ref specialization.

Definition at line 192 of file funcref_impl.h.

◆ requires() [1/2]

template<typename _Res , typename... _ArgTypes, bool _Noex>
template<auto __fn, typename _Up , typename _Td = remove_reference_t<_Up>>
std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::requires ( !is_rvalue_reference_v< _Up && >  ) const &

Target object is equivalent to std::bind_front<_fn>(std::ref(__ref)). Bound object is object referenced by second parameter.

◆ requires() [2/2]

template<typename _Res , typename... _ArgTypes, bool _Noex>
template<typename _Fn , typename _Vt = remove_reference_t<_Fn>>
std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::requires ( !is_same_v< remove_cv_t< _Vt >, function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)> >  ) const &&
inlinenoexcept

Target and bound object is object referenced by parameter.

Definition at line 98 of file funcref_impl.h.


The documentation for this class was generated from the following file: