|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ACallable type is a type for which theINVOKE andINVOKE<R> operations (used by, e.g.,std::function,std::bind, andstd::thread::thread) are applicable.
| (since C++17) |
| (since C++23) |
Contents |
The typeT satisfiesCallable if
Given
f, an object of typeT,ArgTypes, suitable list of argument types,R, suitable return type.The following expressions must be valid:
| Expression | Requirements |
|---|---|
| INVOKE<R>(f,std::declval<ArgTypes>()...) | The expression is well-formed in unevaluated context. |
Pointers to data members areCallable, even though no function calls take place.
In addition, the following standard library facilities accept anyCallable type (not justFunctionObject):
(C++11) | copyable wrapper of any copy constructible callable object (class template)[edit] |
(C++23) | move-only wrapper of any callable object that supports qualifiers in a given call signature (class template)[edit] |
(C++26) | copyable wrapper of any copy constructible callable object that supports qualifiers in a given call signature (class template)[edit] |
(C++26) | non-owning wrapper of any callable object (class template)[edit] |
(C++11) | binds one or more arguments to a function object (function template)[edit] |
(C++20)(C++23) | bind a variable number of arguments, in order, to a function object (function template)[edit] |
(C++11) | CopyConstructible andCopyAssignable reference wrapper (class template)[edit] |
(C++11)(removed in C++20)(C++17) | deduces the result type of invoking a callable object with a set of arguments (class template)[edit] |
(C++11) | manages a separate thread (class)[edit] |
(C++20) | std::thread with support for auto-joining and cancellation (class)[edit] |
(C++11) | invokes a function only once even if called from multiple threads (function template)[edit] |
(C++11) | runs a function asynchronously (potentially in a new thread) and returns astd::future that will hold the result (function template)[edit] |
(C++11) | packages a function to store its return value for asynchronous retrieval (class template)[edit] |
| checks if a type can be invoked (as if bystd::invoke) with the given argument types (class template)[edit] | |
(C++20) | specifies that a callable type can be invoked with a given set of argument types (concept)[edit] |
(C++17)(C++23) | invokes anyCallable object with given argumentsand possibility to specify return type(since C++23) (function template)[edit] |