Namespaces
Variants

std::copyable_function:: operator()

From cppreference.net
Utilities library
Function objects
Function invocation
(C++17) (C++23)
Identity function object
(C++20)
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++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*/ ) ;
(seit C++26)

Ruft das gespeicherte aufrufbare Ziel mit den Parametern args auf. Die /*cv*/ -, /*ref*/ - und /*noex*/ -Teile von operator ( ) sind identisch mit denen des Template-Parameters von std::copyable_function .

Entspricht return std:: invoke_r < R > ( /*cv-ref-cast*/ ( f ) , std:: forward < Args > ( args ) ... ) ; , wobei f ein cv-unqualifizierter Lvalue ist, der das Zielobjekt von * this bezeichnet, und /*cv-ref-cast*/ ( f ) äquivalent ist zu:

  • f wenn cv ref entweder leer oder & ist, oder
  • std:: as_const ( f ) wenn cv ref entweder const oder const & ist, oder
  • std :: move ( f ) wenn cv ref && ist, oder
  • std :: move ( std:: as_const ( f ) ) wenn cv ref const && ist.

Das Verhalten ist undefiniert, wenn * this leer ist.

Inhaltsverzeichnis

Parameter

args - Parameter, die an das gespeicherte aufrufbare Ziel übergeben werden

Rückgabewert

std:: invoke_r < R > ( /*cv-ref-cast*/ ( f ) , std:: forward < Args > ( args ) ... ) .

Exceptions

Verbreitet die Ausnahme, die durch den zugrunde liegenden Funktionsaufruf ausgelöst wird.

Beispiel

Siehe auch

ruft das Ziel auf
(öffentliche Elementfunktion von std::function<R(Args...)> )
ruft das Ziel auf
(öffentliche Elementfunktion von std::move_only_function )
ruft die gespeicherte Funktion auf
(öffentliche Elementfunktion von std::reference_wrapper<T> )
(C++17) (C++23)
ruft jedes Callable Objekt mit den gegebenen Argumenten auf mit Möglichkeit zur Spezifikation des Rückgabetyps (seit C++23)
(Funktions-Template)