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

libstdc++

std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)> Class Template Reference
Utilities » Function Objects

`#include <functional>`

## Public Member Functions
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&>
constexpr | function_ref (_Fn &&__f) noexcept
template<typename _Fn> requires is_function_v<_Fn> && __is_invocable_using<_Fn*>
| function_ref (_Fn *__fn) noexcept
template<auto __cwfn, typename _Fn> requires __is_invocable_using<const _Fn&>
constexpr | function_ref (constant_wrapper< __cwfn, _Fn >) noexcept
template<auto __cwfn, typename _Fn, typename _Td> requires __is_invocable_using<const _Fn&, _Td _GLIBCXX_MOF_CV*>
constexpr | function_ref (constant_wrapper< __cwfn, _Fn >, _Td _GLIBCXX_MOF_CV *__ptr) noexcept
template<auto __cwfn, typename _Fn, typename _Up, typename _Td = remove_reference_t<_Up>> requires (!is_rvalue_reference_v<_Up&&>) && __is_invocable_using<const _Fn&, _Td _GLIBCXX_MOF_CV&>
constexpr | function_ref (constant_wrapper< __cwfn, _Fn >, _Up &&__ref) noexcept
_Res | operator() (_ArgTypes... __args) const noexcept(_Noex)
template<typename _Tp> requires (!is_same_v<_Tp, function_ref>) && (!is_pointer_v<_Tp>) && (!__is_constant_wrapper_v<_Tp>)
function_ref & | operator= (_Tp)=delete

## 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/5]

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/5]

template<typename _Res, typename... _ArgTypes, bool _Noex>
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&>

std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::function_ref | ( | _Fn && | __f | ) |
| inlineconstexprnoexcept

Target and bound object is object referenced by parameter.

Definition at line 107 of file funcref_impl.h.

References std::addressof(), and std::forward().

## ◆ function_ref() [3/5]

template<typename _Res, typename... _ArgTypes, bool _Noex>
template<auto __cwfn, typename _Fn>
requires __is_invocable_using<const _Fn&>

std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::function_ref | ( | constant_wrapper< __cwfn, _Fn > |  | ) |
| inlineconstexprnoexcept

Target object is __fn. There is no bound object.

Definition at line 135 of file funcref_impl.h.

References std::__invoke().

## ◆ function_ref() [4/5]

template<typename _Res, typename... _ArgTypes, bool _Noex>
template<auto __cwfn, typename _Fn, typename _Up, typename _Td = remove_reference_t<_Up>>
requires (!is_rvalue_reference_v<_Up&&>) && __is_invocable_using<const _Fn&, _Td _GLIBCXX_MOF_CV&>

std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::function_ref | ( | constant_wrapper< __cwfn, _Fn > | ,
|  | _Up && | __ref )
| inlineconstexprnoexcept

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

Definition at line 159 of file funcref_impl.h.

References std::addressof().

## ◆ function_ref() [5/5]

template<typename _Res, typename... _ArgTypes, bool _Noex>
template<auto __cwfn, typename _Fn, typename _Td>
requires __is_invocable_using<const _Fn&, _Td _GLIBCXX_MOF_CV*>

std::function_ref< _Res(_ArgTypes...) _GLIBCXX_MOF_CV noexcept(_Noex)>::function_ref | ( | constant_wrapper< __cwfn, _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 180 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 205 of file funcref_impl.h.

References std::forward().

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

- funcref_impl.h