Futures Library: Future Traits
Determine properties of future types.
Classes
Classes | Description |
---|---|
has_executor | Determine if a future type has an executor. (struct) |
has_ready_notifier | Customization point to determine if a type has a ready notifier. (struct) |
is_always_deferred | Customization point to define a future as always deferred. (struct) |
is_continuable | Customization point to define future as supporting continuations. (struct) |
is_future_like | Customization point to determine if a type is a future type. (struct) |
is_shared_future | Customization point to determine if a type is a shared future type. (struct) |
Types
Member Types | Definition |
---|---|
future_value | Determine type the future object holds. (using) |
future_value_t | Determine type the future object holds. (using) |
has_stop_token | Customization point to define future as having a common stop token. (using) |
is_stoppable | Customization point to define future as stoppable. (using) |
Attributes
Member Attributes | Description |
---|---|
has_executor_v | Determine if a future type has an executor. (public variable template) |
has_ready_notifier_v | Customization point to determine if a type has a ready notifier. (public variable template) |
has_stop_token_v | Customization point to define future as having a common stop token. (public variable template) |
is_always_deferred_v | Customization point to define future as always deferred. (public variable template) |
is_continuable_v | Customization point to define future as supporting continuations. (public variable template) |
is_future_like_v | Customization point to determine if a type is a future type. (public variable template) |
is_shared_future_v | Customization point to determine if a type is a shared future type. (public variable template) |
is_stoppable_v | Customization point to define future as stoppable. (public variable template) |
future_like | A class is considered future-like when 1) it specializes the is_future_like trait to indicate it is a future type, or 2) it has the a get() function to obtain its future value. (public concept template) |
Types
using future_value
Defined in header <futures/traits/future_value.hpp>
template <class T>
using future_value = /* see below */;
Determine type the future object holds.
Description
Primary template handles non-future types
Note: Not to be confused with continuation unwrapping
using future_value_t
Defined in header <futures/traits/future_value.hpp>
template <class T>
using future_value_t = typename future_value< T >::type;
Determine type the future object holds.
Description
Primary template handles non-future types
Note: Not to be confused with continuation unwrapping
using has_stop_token
Defined in header <futures/traits/has_stop_token.hpp>
template <class T>
using has_stop_token = /* see below */;
Customization point to define future as having a common stop token.
Description
Besides being stoppable, this trait identifies whether the future has a stop token, which means this token can be shared with other futures to create a common thread of futures that can be stopped with the same token.
Unless the trait is specialized, a type is considered to have a stop token if it has the get_stop_source()
and get_stop_token()
member functions.
See Also:
- is_stoppable
using is_stoppable
Defined in header <futures/traits/is_stoppable.hpp>
template <class T>
using is_stoppable = /* see below */;
Customization point to define future as stoppable.
Description
This trait identifies whether the future is stoppable, which means the future has a request_stop
function to stop the underlying task.
Unless the trait is specialized, a type is considered stoppable if it has the request_stop()
member function.
See Also:
- has_stop_token
Note: Not all stoppable futures have stops token, which can be shared with other futures to create a common thread of futures that can be stopped with the same token.
Attributes
variable has_executor_v
Defined in header <futures/traits/has_executor.hpp>
constexpr bool has_executor_v = has_executor<T>::value;
Determine if a future type has an executor.
variable has_ready_notifier_v
Defined in header <futures/traits/has_ready_notifier.hpp>
constexpr bool has_ready_notifier_v = has_ready_notifier<T>::value;
Customization point to determine if a type has a ready notifier.
Description
The ready notifier is an external handle used to identify when the future is ready.
variable has_stop_token_v
Defined in header <futures/traits/has_stop_token.hpp>
constexpr bool has_stop_token_v = has_stop_token<T>::value;
Customization point to define future as having a common stop token.
Description
Besides being stoppable, this trait identifies whether the future has a stop token, which means this token can be shared with other futures to create a common thread of futures that can be stopped with the same token.
Unless the trait is specialized, a type is considered to have a stop token if it has the get_stop_source()
and get_stop_token()
member functions.
See Also:
- is_stoppable
variable is_always_deferred_v
Defined in header <futures/traits/is_always_deferred.hpp>
constexpr bool is_always_deferred_v = is_always_deferred<T>::value;
Customization point to define future as always deferred.
variable is_continuable_v
Defined in header <futures/traits/is_continuable.hpp>
constexpr bool is_continuable_v = is_continuable<T>::value;
Customization point to define future as supporting continuations.
variable is_future_like_v
Defined in header <futures/traits/is_future_like.hpp>
constexpr bool is_future_like_v = is_future_like<T>::value;
Customization point to determine if a type is a future type.
Description
This trait identifies whether the type represents a future value.
Unless the trait is specialized, a type is considered future-like if it has the get()
member function.
See Also:
- has_stop_token
variable is_shared_future_v
Defined in header <futures/traits/is_shared_future.hpp>
constexpr bool is_shared_future_v = is_shared_future<T>::value;
Customization point to determine if a type is a shared future type.
variable is_stoppable_v
Defined in header <futures/traits/is_stoppable.hpp>
constexpr bool is_stoppable_v = is_stoppable<T>::value;
Customization point to define future as stoppable.
Description
This trait identifies whether the future is stoppable, which means the future has a request_stop
function to stop the underlying task.
Unless the trait is specialized, a type is considered stoppable if it has the request_stop()
member function.
See Also:
- has_stop_token
Note: Not all stoppable futures have stops token, which can be shared with other futures to create a common thread of futures that can be stopped with the same token.
concept future_like
Defined in header <futures/traits/is_future_like.hpp>
template<class T>
concept future_like = is_future_like_v<std::decay_t<T>>;
A class is considered future-like when 1) it specializes the is_future_like
trait to indicate it is a future type, or 2) it has the a get()
function to obtain its future value.
Template Parameters
- T - The type being tested for conformance to the future_like concept.
Description
An object with the common members of a future.
This allows algorithms to interoperate with future types from other libraries.
Updated on 2023-01-04