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>>
constexpr | function_ref (_Fn &&__f) noexcept
template<typename _Fn>
| function_ref (_Fn *__fn) noexcept
template<auto __cwfn, typename _Fn>
constexpr | function_ref (constant_wrapper< __cwfn, _Fn >) noexcept
template<auto __cwfn, typename _Fn, typename _Td>
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>>
constexpr | function_ref (constant_wrapper< __cwfn, _Fn >, _Up &&__ref) noexcept
_Res | operator() (_ArgTypes... __args) const noexcept(_Noex)
template<typename _Tp>
function_ref & | operator= (_Tp)=delete

## Friends
template<typename _Func>
constexpr auto & | __polyfunc::__base_of (_Func &) noexcept
template<typename _Func>
constexpr auto & | __polyfunc::__invoker_of (_Func &) noexcept
template<typename _Dst, typename _Src>
consteval bool | __polyfunc::__is_funcref_assignable () noexcept
template<typename _Src, typename _Dst>
consteval bool | __polyfunc::__is_invoker_convertible () 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/5]

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

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 110 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>

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 138 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>>

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 161 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>

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 182 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 209 of file funcref_impl.h.

References std::forward().

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

- funcref_impl.h