Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/functional/function ref/operator()"

From cppreference.com
m (fmt)
m (fmt)
 
Line 1: Line 1:
{{cpp/utility/functional/function_ref/title | operator()}}
+
{{cpp/utility/functional/function_ref/title|operator()}}
 
{{cpp/utility/functional/function_ref/navbar}}
 
{{cpp/utility/functional/function_ref/navbar}}
{{ddcl | since=c++26 |
+
{{ddcl|since=c++26|
 
R operator()( Args... args ) const noexcept(/*noex*/);
 
R operator()( Args... args ) const noexcept(/*noex*/);
 
}}
 
}}
Line 11: Line 11:
 
===Parameters===
 
===Parameters===
 
{{par begin}}
 
{{par begin}}
{{par | args | rest parameters to pass to the stored {{tti|thunk-ptr}}}}
+
{{par|args|rest parameters to pass to the stored {{tti|thunk-ptr}}}}
 
{{par end}}
 
{{par end}}
  
Line 25: Line 25:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/utility/functional/function/dsc operator()}}
+
{{dsc inc|cpp/utility/functional/function/dsc operator()}}
{{dsc inc | cpp/utility/functional/reference_wrapper/dsc operator()}}
+
{{dsc inc|cpp/utility/functional/reference_wrapper/dsc operator()}}
 
{{dsc end}}
 
{{dsc end}}
  
 
{{langlinks|de|es|fr|it|ja|pt|ru|zh}}
 
{{langlinks|de|es|fr|it|ja|pt|ru|zh}}

Latest revision as of 00:42, 4 January 2024

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
Function objects
Function invocation
(C++17)(C++23)
Identity function object
(C++20)
Transparent operator wrappers
(C++14)
(C++14)
(C++14)
(C++14)  
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)

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++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 ) const noexcept(/*noex*/);
(since C++26)

Invokes the stored thunk-ptr with bound-entity as its first parameter and the rest of the parameters args. The /*noex*/ part of operator() is identical to those of the template parameter of std::function_ref.

Equivalent to return thunk-ptr(bound-entity, std::forward<Args>(args)...);.

Contents

[edit] Parameters

args - rest parameters to pass to the stored thunk-ptr

[edit] Return value

thunk-ptr(bound-entity, std::forward<Args>(args)...).

[edit] Exceptions

Propagates the exception thrown by the underlying function call.

[edit] Example

[edit] See also

invokes the target
(public member function of std::function<R(Args...)>) [edit]
calls the stored function
(public member function of std::reference_wrapper<T>) [edit]