Namespaces
Variants
Actions

std::copyable_function::operator()

From cppreference.com
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
(C++20)(C++20)(C++20)  
(C++20)
(C++20)
(C++14)
(C++11)
(C++11)
(C++23)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)


 
Function objects
(C++17)(C++23)
Identity function object
(C++20)
(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++20*)
(until C++20*)
(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++20*)
(until C++20*)
 
 
R operator()( Args... args ) /*cv*/ /*ref*/ noexcept(/*noex*/);
(since C++26)

Invokes the stored callable target with the parameters args. The /*cv*/, /*ref*/, and /*noex*/ parts of operator() are identical to those of the template parameter of std::copyable_function.

Equivalent to return std::invoke_r <R>(/*cv-ref-cast*/(f), std::forward <Args>(args)...);, where f is a cv-unqualified lvalue that denotes the target object of *this, and /*cv-ref-cast*/(f) is equivalent to:

  • f if cv ref is either empty or &, or
  • std::as_const (f) if cv ref is either const or const &, or
  • std::move(f) if cv ref is &&, or
  • std::move(std::as_const (f)) if cv ref is const &&.

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 of std::function<R(Args...)>) [edit]
invokes the target
(public member function of std::move_only_function) [edit]
calls the stored function
(public member function of std::reference_wrapper<T>) [edit]
(C++17)(C++23)
invokes any Callable object with given arguments and possibility to specify return type(since C++23)
(function template) [edit]
Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/copyable_function/operator()&oldid=177968"

AltStyle によって変換されたページ (->オリジナル) /