Function objects | |
| |
| |
| |
Old binders and adaptors |
| | | | | | (until C++17*)(until C++17*)(until C++17*)(until C++17*) | | |
| (until C++17*)(until C++17*) | (until C++17*)(until C++17*) |
| | (until C++17*)(until C++17*)(until C++17*)(until C++17*) | | |
|
R operator()( Args...args)/*cv*//*ref*/noexcept(/*noex*/); | | (since C++26) |
| | |
Invokes the stored callable target with the parametersargs
. The/*cv*/,/*ref*/, and/*noex*/ parts ofoperator() are identical to those of the template parameter ofstd::copyable_function
.
Equivalent toreturnstd::invoke_r<R>(/*cv-ref-cast*/(f),std::forward<Args>(args)...);, wheref
is a cv-unqualified lvalue that denotes the target object of*this, and/*cv-ref-cast*/(f) is equivalent to:
- f ifcvref is either empty or&, or
- std::as_const(f) ifcvref is eitherconst orconst&, or
- std::move(f) ifcvref is&&, or
- std::move(std::as_const(f)) ifcvref isconst&&.
The behavior is undefined if*this is empty.
[edit]Parameters
args | - | parameters to pass to the stored callable target |
[edit]Return value
std::invoke_r<R>(/*cv-ref-cast*/(f),std::forward<Args>(args)...).
[edit]Exceptions
Propagates the exception thrown by the underlying function call.
[edit]Example
| This section is incomplete Reason: no example |
[edit]See also
| invokes the target (public member function ofstd::function<R(Args...)> )[edit] |
| invokes the target (public member function ofstd::move_only_function )[edit] |
| calls the stored function (public member function ofstd::reference_wrapper<T> )[edit] |
| invokes anyCallable object with given argumentsand possibility to specify return type(since C++23) (function template)[edit] |