Skip to content

futures

Main library namespace.

Classes

Classes Description
all_of_functor Functor representing the overloads for the all_of function.
(class)
always_deferred_opt Future option to determine the future is always_deferred.
(struct)
always_detached_opt Future option to determine the future is always_detached.
(struct)
any_of_functor Functor representing the overloads for the any_of function.
(class)
basic_future A basic future type with custom features.
(class)
binary_invoke_algorithm_functor Binary algorithm overloads.
(class)
broken_promise The state owner got destroyed before the promise has been fulfilled.
(class)
compare_three_way Function object for performing comparisons.
(struct)
continuable_opt Future option to determine the future is continuable.
(struct)
count_functor Functor representing the overloads for the count function.
(class)
count_if_functor Functor representing the overloads for the count_if function.
(class)
deferred_function_opt Type of the deferred function.
(struct)
equal_to A C++17 functor equivalent to the C++20 std::ranges::equal_to.
(struct)
error Class for errors in the futures library.
(class)
executor_opt Future option to identify the executor to be used by a future.
(struct)
find_functor Functor representing the overloads for the find function.
(class)
find_if_functor Functor representing the overloads for the find_if function.
(class)
find_if_not_functor Functor representing the overloads for the find_if_not function.
(class)
for_each_functor Functor representing the overloads for the for_each function.
(class)
future_already_retrieved Attempted to retrieve a unique future twice.
(class)
future_deferred Invalid operation on deferred future.
(class)
future_uninitialized The future hasn't been initialized yet.
(class)
greater A C++17 functor equivalent to the C++20 std::ranges::greater.
(struct)
greater_equal A C++17 functor equivalent to the C++20 std::ranges::greater_equal.
(struct)
halve_partitioner A partitioner that always splits the problem in half.
(class)
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)
inline_executor An executor that runs anything inline.
(class)
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_execution_policy Determines whether T is a standard or implementation-defined execution policy type.
(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)
less A C++17 functor equivalent to the C++20 std::ranges::less.
(struct)
less_equal A C++17 functor equivalent to the C++20 std::ranges::less_equal.
(struct)
new_thread_executor An executor that runs anything in a new thread, like std::async does.
(class)
no_state There is no shared state we can access.
(class)
none_of_functor Functor representing the overloads for the none_of function.
(class)
nostopstate_t Empty struct to initialize a stop_source without a shared stop state.
(struct)
not_equal_to A C++17 functor equivalent to the C++20 std::ranges::not_equal_to.
(struct)
packaged_task< R(Args...), Options > A packaged task that sets a shared state when done.
(class)
packaged_task_uninitialized The packaged task hasn't been initialized yet.
(class)
promise A shared state that will later be acquired by a future type.
(class)
promise_already_satisfied Promise has already been fulfilled.
(class)
promise_base Common members to promises of all types.
(class)
promise_uninitialized The promised hasn't been initialized yet.
(class)
reduce_functor Functor representing the overloads for the reduce function.
(class)
shared_opt Future option to determine the future is shared.
(struct)
stop_source Object used to issue a stop request.
(class)
stop_token Token to check if a stop request has been made.
(class)
stoppable_opt Future option to determine the future is stoppable.
(struct)
thread_partitioner A partitioner that always splits the problem when moving to new threads.
(class)
thread_pool A thread pool with the specified number of threads.
(class)
unary_invoke_algorithm_functor Overloads for unary invoke algorithms.
(class)
value_cmp_algorithm_functor Value-compare algorithm overloads.
(class)
when_all_future Proxy future class referring to a conjunction of futures from when_all.
(class)
when_any_future Future object referring to the result of a disjunction of futures.
(class)
when_any_result Result type for when_any_future objects.
(struct)

Types

Member Types Definition
future_errc Error codes for futures.
(enum)
future_status Specifies state of a future.
(enum)
future A simple future type similar to std::future
(using)
cfuture A future type with lazy continuations.
(using)
jcfuture A future type with lazy continuations and stop tokens.
(using)
dfuture A deferred future type.
(using)
jdfuture A deferred stoppable future type.
(using)
vfuture A future that simply holds a ready value.
(using)
shared_future A simple std::shared_future.
(using)
shared_cfuture A shared future type with lazy continuations.
(using)
shared_jcfuture A shared future type with lazy continuations and stop tokens.
(using)
shared_dfuture A shared future type with deferred task.
(using)
shared_jdfuture A shared future type with deferred task and stop token.
(using)
shared_vfuture A shared future that simply holds a ready value.
(using)
partial_ordering the result type of 3-way comparison that supports all 6 operators,
(using)
strong_ordering the result type of 3-way comparison that supports all 6 operators and is substitutable
(using)
weak_ordering the result type of 3-way comparison that supports all 6 operators, does
(using)
default_partitioner Default partitioner used by parallel algorithms.
(using)
is_partitioner_for Determine if P is a valid partitioner for the iterator range [I,S].
(using)
sequenced_policy Class representing a type for a sequenced_policy tag.
(using)
parallel_policy Class representing a type for a parallel_policy tag.
(using)
parallel_unsequenced_policy Class representing a type for a parallel_unsequenced_policy tag.
(using)
unsequenced_policy Class representing a type for an unsequenced_policy tag.
(using)
common_comparison_category A type trait equivalent to the std::equality_comparable concept.
(using)
common_comparison_category_t A type trait equivalent to the std::equality_comparable concept.
(using)
is_assignable_from A type trait equivalent to the std::assignable_from concept.
(using)
is_bidirectional_iterator A type trait equivalent to the std::bidirectional_iterator concept.
(using)
is_constructible_from A type trait equivalent to the std::constructible_from concept.
(using)
is_convertible_to A type trait equivalent to the std::convertible_to concept.
(using)
is_copyable A type trait equivalent to the std::copyable concept.
(using)
is_default_initializable A type trait equivalent to the std::default_initializable concept.
(using)
is_derived_from A type trait equivalent to the derived_from concept.
(using)
is_equality_comparable A type trait equivalent to the std::equality_comparable concept.
(using)
is_equality_comparable_with A type trait equivalent to the std::equality_comparable_with concept.
(using)
is_forward_iterator A type trait equivalent to the std::forward_iterator concept.
(using)
is_incrementable A type trait equivalent to the std::incrementable concept.
(using)
is_indirectly_binary_invocable Determine if a function can be invoke with the value type of both iterators.
(using)
is_indirectly_readable A type trait equivalent to the std::indirectly_readable concept.
(using)
is_indirectly_unary_invocable A type trait equivalent to the std::indirectly_unary_invocable concept.
(using)
is_input_iterator A type trait equivalent to the std::input_iterator concept.
(using)
is_input_or_output_iterator A type trait equivalent to the std::is_input_or_output_iterator concept.
(using)
is_input_range A type trait equivalent to the std::input_range concept.
(using)
is_movable A type trait equivalent to the std::movable concept.
(using)
is_move_constructible A type trait equivalent to the std::move_constructible concept.
(using)
is_random_access_iterator A type trait equivalent to the std::random_access_iterator concept.
(using)
is_range A type trait equivalent to the std::range concept.
(using)
is_regular A type trait equivalent to the std::regular concept.
(using)
is_semiregular A type trait equivalent to the std::semiregular concept.
(using)
is_sentinel_for A type trait equivalent to the std::sentinel_for concept.
(using)
is_swappable A type trait equivalent to the std::swappable concept.
(using)
is_three_way_comparable A type trait equivalent to the std::equality_comparable concept.
(using)
is_three_way_comparable_with A type trait equivalent to the std::equality_comparable_with concept.
(using)
is_totally_ordered A type trait equivalent to the std::totally_ordered concept.
(using)
is_totally_ordered_with A type trait equivalent to the std::totally_ordered_with concept.
(using)
is_weakly_incrementable A type trait equivalent to the std::weakly_incrementable concept.
(using)
iter_difference A type trait equivalent to std::iter_difference
(using)
iter_difference_t A type trait equivalent to std::iter_difference
(using)
iter_reference A type trait equivalent to std::iter_reference
(using)
iter_reference_t A type trait equivalent to std::iter_reference
(using)
iter_rvalue_reference A type trait equivalent to std::iter_rvalue_reference
(using)
iter_rvalue_reference_t A type trait equivalent to std::iter_rvalue_reference
(using)
iter_value A type trait equivalent to std::iter_value
(using)
iter_value_t A type trait equivalent to std::iter_value
(using)
iterator A type trait equivalent to the std::iterator trait.
(using)
iterator_t A type trait equivalent to the std::iterator trait.
(using)
range_value A type trait equivalent to std::range_value
(using)
range_value_t A type trait equivalent to std::range_value
(using)
remove_cvref A type trait equivalent to std::remove_cvref
(using)
remove_cvref_t A type trait equivalent to std::remove_cvref
(using)
default_execution_context_type The default execution context for async operations.
(using)
default_executor_type Default executor type.
(using)
is_execution_context_for Determine if type is an execution context for the specified type of task.
(using)
is_execution_context Determines if a type is an execution context for invocable types.
(using)
is_executor_for Determine if type is an executor for the specified type of task.
(using)
is_executor Determines if a type is an executor for invocable types.
(using)
future_options /* see documentation below */
(using)
source_location A library type equivalent to std::source_location
(using)
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)

Functions

Member Functions Description
operator% Create a proxy pair with a lambda and an executor.
(function template)
make_ready_future Make a placeholder future object that is ready at construction.
(function)
make_exceptional_future Make a placeholder future object that is ready with an exception from an exception ptr.
(function template)
then Schedule a continuation function to a future.
(function template)
operator>> Operator to schedule a continuation function to a future.
(function template)
when_all Create a future object that becomes ready when the range of input futures becomes ready.
(function template)
operator&& Create a future object that becomes ready when the range of input futures becomes ready.
(function template)
when_any Create a future object that becomes ready when any of the futures in the range is ready.
(function template)
operator|| Create a future object that becomes ready when any of the futures in the range is ready.
(function template)
make_grain_size Determine a reasonable minimum grain size depending on the number of elements in a sequence.
(function)
make_default_partitioner Create an instance of the default partitioner with a reasonable grain size for n elements.
(function)
await Wait for future types and retrieve their values.
(function template)
default_execution_context Create an instance of the default execution context.
(function)
make_default_executor Create an Asio thread pool executor for the default thread pool.
(function)
execute Submits a task for execution.
(function template)
hardware_concurrency A version of hardware_concurrency that always returns at least 1.
(function)
make_inline_executor Make an inline executor object.
(function)
make_new_thread_executor Make an new thread executor object.
(function)
is_ready Check if a future is ready.
(function template)
async Launch an asynchronous task with the specified executor.
(function template)
schedule Schedule an asynchronous task with the specified executor.
(function template)
swap Specializes the std::swap algorithm.
(function template)
handle_exception Customization point to handle exceptions.
(function)
throw_exception Library function used to throw exceptions.
(function template)
wait_for_all Wait for a sequence of futures to be ready.
(function template)
wait_for_all_for Wait for a sequence of futures to be ready.
(function template)
wait_for_all_until Wait for a sequence of futures to be ready.
(function template)
wait_for_any Wait for any future in a sequence to be ready.
(function template)
wait_for_any_for Wait for any future in a sequence to be ready.
(function template)
wait_for_any_until Wait for any future in a sequence to be ready.
(function template)

Attributes

Member Attributes Description
all_of Checks if a predicate is true for all the elements in a range.
(public variable)
any_of Checks if a predicate is true for any of the elements in a range.
(public variable)
count Returns the number of elements matching an element.
(public variable)
count_if Returns the number of elements satisfying specific criteria.
(public variable)
find Finds the first element equal to another element.
(public variable)
find_if Finds the first element satisfying specific criteria.
(public variable)
find_if_not Finds the first element not satisfying specific criteria.
(public variable)
for_each Applies a function to a range of elements.
(public variable)
none_of Checks if a predicate is true for none of the elements in a range.
(public variable)
is_partitioner_for_v Determine if P is a valid partitioner for the iterator range [I,S].
(public variable template)
seq Tag used in algorithms for a sequenced_policy.
(public variable)
par Tag used in algorithms for a parallel_policy.
(public variable)
par_unseq Tag used in algorithms for a parallel_unsequenced_policy.
(public variable)
unseq Tag used in algorithms for an unsequenced_policy.
(public variable)
is_execution_policy_v Determines whether T is a standard or implementation-defined execution policy type.
(public variable template)
reduce Sums up (or accumulate with a custom function) a range of elements, except out of order.
(public variable)
is_assignable_from_v A type trait equivalent to the std::assignable_from concept.
(public variable template)
is_bidirectional_iterator_v A type trait equivalent to the std::bidirectional_iterator concept.
(public variable template)
is_constructible_from_v A type trait equivalent to the std::constructible_from concept.
(public variable template)
is_convertible_to_v A type trait equivalent to the std::convertible_to concept.
(public variable template)
is_copyable_v A type trait equivalent to the std::copyable concept.
(public variable template)
is_default_initializable_v A type trait equivalent to the std::default_initializable concept.
(public variable template)
is_derived_from_v A type trait equivalent to the derived_from concept.
(public variable template)
is_equality_comparable_v A type trait equivalent to the std::equality_comparable concept.
(public variable template)
is_equality_comparable_with_v A type trait equivalent to the std::equality_comparable_with concept.
(public variable template)
is_forward_iterator_v A type trait equivalent to the std::forward_iterator concept.
(public variable template)
is_incrementable_v A type trait equivalent to the std::incrementable concept.
(public variable template)
is_indirectly_binary_invocable_v Determine if a function can be invoke with the value type of both iterators.
(public variable template)
is_indirectly_readable_v A type trait equivalent to the std::indirectly_readable concept.
(public variable template)
is_indirectly_unary_invocable_v A type trait equivalent to the std::indirectly_unary_invocable concept.
(public variable template)
is_input_iterator_v A type trait equivalent to the std::input_iterator concept.
(public variable template)
is_input_or_output_iterator_v A type trait equivalent to the std::is_input_or_output_iterator concept.
(public variable template)
is_input_range_v A type trait equivalent to the std::input_range concept.
(public variable template)
is_movable_v A type trait equivalent to the std::movable concept.
(public variable template)
is_move_constructible_v A type trait equivalent to the std::move_constructible concept.
(public variable template)
is_random_access_iterator_v A type trait equivalent to the std::random_access_iterator concept.
(public variable template)
is_range_v A type trait equivalent to the std::range concept.
(public variable template)
is_regular_v A type trait equivalent to the std::regular concept.
(public variable template)
is_semiregular_v A type trait equivalent to the std::semiregular concept.
(public variable template)
is_sentinel_for_v A type trait equivalent to the std::sentinel_for concept.
(public variable template)
is_swappable_v A type trait equivalent to the std::swappable concept.
(public variable template)
is_three_way_comparable_v A type trait equivalent to the std::equality_comparable concept.
(public variable template)
is_three_way_comparable_with_v A type trait equivalent to the std::equality_comparable_with concept.
(public variable template)
is_totally_ordered_v A type trait equivalent to the std::totally_ordered concept.
(public variable template)
is_totally_ordered_with_v A type trait equivalent to the std::totally_ordered_with concept.
(public variable template)
is_weakly_incrementable_v A type trait equivalent to the std::weakly_incrementable concept.
(public variable template)
is_execution_context_for_v Determine if type is an execution context for the specified type of task.
(public variable template)
is_execution_context_v Determines if a type is an execution context for invocable types.
(public variable template)
is_executor_for_v Determine if type is an executor for the specified type of task.
(public variable template)
is_executor_v Determines if a type is an executor for invocable types.
(public variable template)
nostopstate Empty struct to initialize a stop_source without a shared stop state.
(public variable)
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)
execution_policy Determines if a type is an execution_policy.
(public concept template)
partitioner_for Determines if a type is an partitioner.
(public concept template)
execution_context_for Determines if a type is an execution context for the a task type.
(public concept template)
execution_context The invocable archetype task is a regular functor.
(public concept template)
executor_for Determines if a type is an executor for the specified type of task.
(public concept 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)
executor The invocable archetype task is a regular functor.
(public concept template)

Types

enum future_errc

Defined in header <futures/error.hpp>

enum class future_errc;

Enumerator Value Description
broken_promise 1 The state owner got destroyed before the promise has been fulfilled.
future_already_retrieved Attempted to retrieve a unique future twice.
promise_already_satisfied Promise has already been fulfilled.
no_state There is no shared state we can access.
promise_uninitialized The promised hasn't been initialized yet.
packaged_task_uninitialized The packaged task hasn't been initialized yet.
future_uninitialized The future hasn't been initialized yet.
future_deferred Invalid operation on deferred future.

Error codes for futures.

enum future_status

Defined in header <futures/future_status.hpp>

enum class future_status;

Enumerator Value Description
ready The operation state is ready.
timeout The operation state did not become ready before specified timeout duration has passed.
deferred The operation state contains a deferred function, so the result will be computed only when explicitly requested.

Specifies state of a future.

Description

Specifies state of a future as returned by wait_for and wait_until functions of basic_future.

using future

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using future = 
    basic_future< T, future_options< executor_opt< Executor > > >;

A simple future type similar to std::future

Description

We should only use this future type for eager tasks that do not expect continuations.

using cfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using cfuture = 
    basic_future< T, future_options< executor_opt< Executor >, continuable_opt > >;

A future type with lazy continuations.

Description

Futures with lazy continuations contains a list of continuation tasks to be launched once the main task is complete.

This is what a futures::async returns by default when the first function parameter is not a futures::stop_token.

using jcfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using jcfuture = 
    basic_future< T, future_options< executor_opt< Executor >, continuable_opt, stoppable_opt > >;

A future type with lazy continuations and stop tokens.

Description

It's a quite common use case that we need a way to cancel futures and jcfuture provides us with an even better way to do that.

This is what futures::async returns when the first function parameter is a futures::stop_token

using dfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using dfuture = 
    basic_future< T, future_options< executor_opt< Executor >, always_deferred_opt > >;

A deferred future type.

Description

This is a future type whose main task will only be launched when we wait for its results from another execution context.

This is what the function schedule returns when the first task parameter is not a stop token.

The state of this future stores the function to be run.

This future type supports continuations without the continuation lists of continuable futures.

using jdfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using jdfuture = 
    basic_future< T, future_options< executor_opt< Executor >, always_deferred_opt > >;

A deferred stoppable future type.

Description

This is a future type whose main task will only be launched when we wait for its results from another execution context.

Once the task is launched, it can be requested to stop through its stop source.

This is what the function schedule returns when the first task parameter is a stop token.

using vfuture

Defined in header <futures/future.hpp>

template <class T>
using vfuture = basic_future< T, future_options<> >;

A future that simply holds a ready value.

Description

This is the future type we use for constant values. This is the future type we usually return from functions such as make_ready_future.

These futures have no support for associated executors, continuations, or deferred tasks.

Like deferred futures, the operation state is stored inline.

using shared_future

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using shared_future = 
    basic_future< T, future_options< executor_opt< Executor >, shared_opt > >;

A simple std::shared_future.

Description

This is what a futures::future::share() returns

using shared_cfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using shared_cfuture = 
    basic_future< T, future_options< executor_opt< Executor >, continuable_opt, shared_opt > >;

A shared future type with lazy continuations.

Description

This is what a futures::cfuture::share() returns

using shared_jcfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using shared_jcfuture = 
    basic_future< T, future_options< executor_opt< Executor >, continuable_opt, stoppable_opt, shared_opt > >;

A shared future type with lazy continuations and stop tokens.

Description

This is what a futures::jcfuture::share() returns

using shared_dfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using shared_dfuture = 
    basic_future< T, future_options< executor_opt< Executor >, always_deferred_opt, shared_opt > >;

A shared future type with deferred task.

Description

This is what a futures::dfuture::share() returns

using shared_jdfuture

Defined in header <futures/future.hpp>

template <class T, class Executor = default_executor_type>
using shared_jdfuture = 
    basic_future< T, future_options< executor_opt< Executor >, stoppable_opt, always_deferred_opt, shared_opt > >;

A shared future type with deferred task and stop token.

Description

This is what a futures::jdfuture::share() returns

using shared_vfuture

Defined in header <futures/future.hpp>

template <class T>
using shared_vfuture = 
    basic_future< T, future_options< shared_opt > >;

A shared future that simply holds a ready value.

using partial_ordering

Defined in header <futures/algorithm/compare/partial_ordering.hpp>

using partial_ordering = std::partial_ordering;

the result type of 3-way comparison that supports all 6 operators,

using strong_ordering

Defined in header <futures/algorithm/compare/strong_ordering.hpp>

using strong_ordering = std::strong_ordering;

the result type of 3-way comparison that supports all 6 operators and is substitutable

using weak_ordering

Defined in header <futures/algorithm/compare/weak_ordering.hpp>

using weak_ordering = std::weak_ordering;

the result type of 3-way comparison that supports all 6 operators, does

using default_partitioner

Defined in header <futures/algorithm/partitioner/default_partitioner.hpp>

using default_partitioner = /* see below */;

Default partitioner used by parallel algorithms.

Description

Its type and parameters might change

using is_partitioner_for

Defined in header <futures/algorithm/partitioner/partitioner_for.hpp>

template <class P, class I, class S = I>
using is_partitioner_for = 
    std::bool_constant< partitioner_for< P, I, S > >;

Determine if P is a valid partitioner for the iterator range [I,S].

using sequenced_policy

Defined in header <futures/algorithm/policies.hpp>

using sequenced_policy = std::execution::sequenced_policy;

Class representing a type for a sequenced_policy tag.

Description

This tag type is an alias to std::execution::sequenced_policy whenever it's available. Otherwise it's defined as an individual type.

using parallel_policy

Defined in header <futures/algorithm/policies.hpp>

using parallel_policy = std::execution::parallel_policy;

Class representing a type for a parallel_policy tag.

Description

This tag type is an alias to std::execution::parallel_policy whenever it's available. Otherwise it's defined as an individual type.

using parallel_unsequenced_policy

Defined in header <futures/algorithm/policies.hpp>

using parallel_unsequenced_policy = 
    std::execution::parallel_unsequenced_policy;

Class representing a type for a parallel_unsequenced_policy tag.

Description

This tag type is an alias to std::execution::parallel_unsequenced_policy whenever it's available. Otherwise it's defined as an individual type.

using unsequenced_policy

Defined in header <futures/algorithm/policies.hpp>

using unsequenced_policy = std::execution::unsequenced_policy;

Class representing a type for an unsequenced_policy tag.

Description

This tag type is an alias to std::execution::unsequenced_policy whenever it's available. Otherwise it's defined as an individual type.

using common_comparison_category

Defined in header <futures/algorithm/traits/common_comparison_category.hpp>

template <class... Ts>
using common_comparison_category = 
    std::common_comparison_category< Ts... >;

A type trait equivalent to the std::equality_comparable concept.

See Also: std::three_way_comparable

using common_comparison_category_t

Defined in header <futures/algorithm/traits/common_comparison_category.hpp>

template <class... Ts>
using common_comparison_category_t = 
    typename common_comparison_category< Ts... >::type;

A type trait equivalent to the std::equality_comparable concept.

See Also: std::three_way_comparable

using is_assignable_from

Defined in header <futures/algorithm/traits/is_assignable_from.hpp>

template <class LHS, class RHS>
using is_assignable_from = 
    std::bool_constant< std::assignable_from< LHS, RHS > >;

A type trait equivalent to the std::assignable_from concept.

See Also: std::assignable_from

using is_bidirectional_iterator

Defined in header <futures/algorithm/traits/is_bidirectional_iterator.hpp>

template <class T>
using is_bidirectional_iterator = 
    std::bool_constant< std::bidirectional_iterator< T > >;

A type trait equivalent to the std::bidirectional_iterator concept.

See Also: std::bidirectional_iterator

using is_constructible_from

Defined in header <futures/algorithm/traits/is_constructible_from.hpp>

template <class T, class... Args>
using is_constructible_from = 
    /* see below */;

A type trait equivalent to the std::constructible_from concept.

See Also: std::constructible_from

using is_convertible_to

Defined in header <futures/algorithm/traits/is_convertible_to.hpp>

template <class From, class To>
using is_convertible_to = 
    std::bool_constant< std::convertible_to< From, To > >;

A type trait equivalent to the std::convertible_to concept.

See Also: std::convertible_to

using is_copyable

Defined in header <futures/algorithm/traits/is_copyable.hpp>

template <class T>
using is_copyable = std::bool_constant< std::copyable< T > >;

A type trait equivalent to the std::copyable concept.

See Also: std::copyable

using is_default_initializable

Defined in header <futures/algorithm/traits/is_default_initializable.hpp>

template <class T>
using is_default_initializable = 
    std::bool_constant< std::default_initializable< T > >;

A type trait equivalent to the std::default_initializable concept.

See Also: std::default_initializable

using is_derived_from

Defined in header <futures/algorithm/traits/is_derived_from.hpp>

template <class Derived, class Base>
using is_derived_from = 
    std::bool_constant< derived_from< Derived, Base > >;

A type trait equivalent to the derived_from concept.

See Also: std::derived_from

using is_equality_comparable

Defined in header <futures/algorithm/traits/is_equality_comparable.hpp>

template <class T>
using is_equality_comparable = 
    std::bool_constant< std::equality_comparable< T > >;

A type trait equivalent to the std::equality_comparable concept.

See Also: std::equality_comparable

using is_equality_comparable_with

Defined in header <futures/algorithm/traits/is_equality_comparable_with.hpp>

template <class T, class U>
using is_equality_comparable_with = 
    std::bool_constant< std::equality_comparable_with< T, U > >;

A type trait equivalent to the std::equality_comparable_with concept.

See Also: std::equality_comparable_with

using is_forward_iterator

Defined in header <futures/algorithm/traits/is_forward_iterator.hpp>

template <class T>
using is_forward_iterator = 
    std::bool_constant< std::forward_iterator< T > >;

A type trait equivalent to the std::forward_iterator concept.

See Also: std::forward_iterator

using is_incrementable

Defined in header <futures/algorithm/traits/is_incrementable.hpp>

template <class I>
using is_incrementable = 
    std::bool_constant< std::incrementable< I > >;

A type trait equivalent to the std::incrementable concept.

See Also: std::incrementable

using is_indirectly_binary_invocable

Defined in header <futures/algorithm/traits/is_indirectly_binary_invocable.hpp>

template <class F, class I1, class I2>
using is_indirectly_binary_invocable = /* see below */;

Determine if a function can be invoke with the value type of both iterators.

using is_indirectly_readable

Defined in header <futures/algorithm/traits/is_indirectly_readable.hpp>

template <class T>
using is_indirectly_readable = 
    std::bool_constant< std::indirectly_readable< T > >;

A type trait equivalent to the std::indirectly_readable concept.

See Also: std::indirectly_readable

using is_indirectly_unary_invocable

Defined in header <futures/algorithm/traits/is_indirectly_unary_invocable.hpp>

template <class F, class I>
using is_indirectly_unary_invocable = 
    std::bool_constant< std::indirectly_unary_invocable< F, I > >;

A type trait equivalent to the std::indirectly_unary_invocable concept.

See Also: std::indirectly_unary_invocable

using is_input_iterator

Defined in header <futures/algorithm/traits/is_input_iterator.hpp>

template <class T>
using is_input_iterator = 
    std::bool_constant< std::input_iterator< T > >;

A type trait equivalent to the std::input_iterator concept.

See Also: std::input_iterator

using is_input_or_output_iterator

Defined in header <futures/algorithm/traits/is_input_or_output_iterator.hpp>

template <class T>
using is_input_or_output_iterator = 
    std::bool_constant< std::is_input_or_output_iterator< T > >;

A type trait equivalent to the std::is_input_or_output_iterator concept.

See Also: std::is_input_or_output_iterator

using is_input_range

Defined in header <futures/algorithm/traits/is_input_range.hpp>

template <class T>
using is_input_range = std::bool_constant< std::is_input_range< T > >;

A type trait equivalent to the std::input_range concept.

See Also: std::ranges::input_range

using is_movable

Defined in header <futures/algorithm/traits/is_movable.hpp>

template <class T>
using is_movable = std::bool_constant< std::movable< T > >;

A type trait equivalent to the std::movable concept.

See Also: std::movable

using is_move_constructible

Defined in header <futures/algorithm/traits/is_move_constructible.hpp>

template <class T>
using is_move_constructible = 
    std::bool_constant< std::move_constructible< T > >;

A type trait equivalent to the std::move_constructible concept.

See Also: std::move_constructible

using is_random_access_iterator

Defined in header <futures/algorithm/traits/is_random_access_iterator.hpp>

template <class T>
using is_random_access_iterator = 
    std::bool_constant< std::random_access_iterator< T > >;

A type trait equivalent to the std::random_access_iterator concept.

See Also: std::random_access_iterator

using is_range

Defined in header <futures/algorithm/traits/is_range.hpp>

template <class T>
using is_range = std::bool_constant< std::range< T > >;

A type trait equivalent to the std::range concept.

See Also: std::ranges::range

using is_regular

Defined in header <futures/algorithm/traits/is_regular.hpp>

template <class T>
using is_regular = std::bool_constant< std::regular< T > >;

A type trait equivalent to the std::regular concept.

See Also: std::regular

using is_semiregular

Defined in header <futures/algorithm/traits/is_semiregular.hpp>

template <class T>
using is_semiregular = std::bool_constant< std::semiregular< T > >;

A type trait equivalent to the std::semiregular concept.

See Also: std::semiregular

using is_sentinel_for

Defined in header <futures/algorithm/traits/is_sentinel_for.hpp>

template <class S, class I>
using is_sentinel_for = 
    std::bool_constant< std::sentinel_for< S, I > >;

A type trait equivalent to the std::sentinel_for concept.

See Also: std::sentinel_for

using is_swappable

Defined in header <futures/algorithm/traits/is_swappable.hpp>

template <class T>
using is_swappable = std::bool_constant< std::swappable< T > >;

A type trait equivalent to the std::swappable concept.

See Also: std::swappable

using is_three_way_comparable

Defined in header <futures/algorithm/traits/is_three_way_comparable.hpp>

template <class T, class Cat = std::partial_ordering>
using is_three_way_comparable = 
    std::bool_constant< std::three_way_comparable< T, Cat > >;

A type trait equivalent to the std::equality_comparable concept.

See Also: std::three_way_comparable

using is_three_way_comparable_with

Defined in header <futures/algorithm/traits/is_three_way_comparable_with.hpp>

template <class T, class U, class Cat = std::partial_ordering>
using is_three_way_comparable_with = 
    std::bool_constant< std::three_way_comparable_with< T, U, Cat > >;

A type trait equivalent to the std::equality_comparable_with concept.

See Also: std::three_way_comparable

using is_totally_ordered

Defined in header <futures/algorithm/traits/is_totally_ordered.hpp>

template <class T>
using is_totally_ordered = 
    std::bool_constant< std::totally_ordered< T > >;

A type trait equivalent to the std::totally_ordered concept.

See Also: std::totally_ordered

using is_totally_ordered_with

Defined in header <futures/algorithm/traits/is_totally_ordered_with.hpp>

template <class T, class U>
using is_totally_ordered_with = 
    std::bool_constant< std::totally_ordered_with< T, U > >;

A type trait equivalent to the std::totally_ordered_with concept.

See Also: std::totally_ordered

using is_weakly_incrementable

Defined in header <futures/algorithm/traits/is_weakly_incrementable.hpp>

template <class I>
using is_weakly_incrementable = 
    std::bool_constant< std::weakly_incrementable< T > >;

A type trait equivalent to the std::weakly_incrementable concept.

See Also: std::weakly_incrementable

using iter_difference

Defined in header <futures/algorithm/traits/iter_difference.hpp>

template <class T>
using iter_difference = std::iter_difference;

A type trait equivalent to std::iter_difference

See Also: std::iter_difference

using iter_difference_t

Defined in header <futures/algorithm/traits/iter_difference.hpp>

template <class T>
using iter_difference_t = typename iter_difference< T >::type;

A type trait equivalent to std::iter_difference

See Also: std::iter_difference

using iter_reference

Defined in header <futures/algorithm/traits/iter_reference.hpp>

template <class T>
using iter_reference = std::iter_reference;

A type trait equivalent to std::iter_reference

See Also: std::iter_reference

using iter_reference_t

Defined in header <futures/algorithm/traits/iter_reference.hpp>

template <class T>
using iter_reference_t = typename iter_reference< T >::type;

A type trait equivalent to std::iter_reference

See Also: std::iter_reference

using iter_rvalue_reference

Defined in header <futures/algorithm/traits/iter_rvalue_reference.hpp>

template <class T>
using iter_rvalue_reference = std::iter_rvalue_reference;

A type trait equivalent to std::iter_rvalue_reference

See Also: std::iter_rvalue_reference

using iter_rvalue_reference_t

Defined in header <futures/algorithm/traits/iter_rvalue_reference.hpp>

template <class T>
using iter_rvalue_reference_t = 
    typename iter_rvalue_reference< T >::type;

A type trait equivalent to std::iter_rvalue_reference

See Also: std::iter_rvalue_reference

using iter_value

Defined in header <futures/algorithm/traits/iter_value.hpp>

template <class T>
using iter_value = std::iter_value;

A type trait equivalent to std::iter_value

See Also: std::iter_value

using iter_value_t

Defined in header <futures/algorithm/traits/iter_value.hpp>

template <class T>
using iter_value_t = typename iter_value< T >::type;

A type trait equivalent to std::iter_value

See Also: std::iter_value

using iterator

Defined in header <futures/algorithm/traits/iterator.hpp>

template <class T>
using iterator = std::iterator< R >;

A type trait equivalent to the std::iterator trait.

See Also: std::ranges::iterator_t

using iterator_t

Defined in header <futures/algorithm/traits/iterator.hpp>

template <class T>
using iterator_t = typename iterator< T >::type;

A type trait equivalent to the std::iterator trait.

See Also: std::ranges::iterator_t

using range_value

Defined in header <futures/algorithm/traits/range_value.hpp>

template <class R>
using range_value = std::range_value< R >;

A type trait equivalent to std::range_value

See Also: std::ranges::iterator_t

using range_value_t

Defined in header <futures/algorithm/traits/range_value.hpp>

template <class R>
using range_value_t = typename range_value< R >::type;

A type trait equivalent to std::range_value

See Also: std::ranges::iterator_t

using remove_cvref

Defined in header <futures/algorithm/traits/remove_cvref.hpp>

template <class T>
using remove_cvref = std::remove_cvref< T >;

A type trait equivalent to std::remove_cvref

See Also: std::remove_cvref

using remove_cvref_t

Defined in header <futures/algorithm/traits/remove_cvref.hpp>

template <class T>
using remove_cvref_t = typename remove_cvref< T >::type;

A type trait equivalent to std::remove_cvref

See Also: std::remove_cvref

using default_execution_context_type

Defined in header <futures/executor/default_executor.hpp>

using default_execution_context_type = /* see below */;

The default execution context for async operations.

Description

Unless an executor is explicitly provided, this is the executor we use for async operations.

This is the ASIO thread pool execution context with a default number of threads. However, the default execution context (and its type) might change in other versions of this library if something more general comes along. As the standard for executors gets adopted, libraries are likely to provide better implementations.

Also note that executors might not allow work-stealing. This needs to be taken into account when implementing algorithms with recursive tasks. One common options is to use try_async for recursive tasks.

Also note that, in the executors notation, the pool is an execution context but not an executor:

  • Execution context: a place where we can execute functions
  • A thread pool is an execution context, not an executor

An execution context is:

  • Usually long lived
  • Non-copyable
  • May contain additional state, such as timers, and threads

using default_executor_type

Defined in header <futures/executor/default_executor.hpp>

using default_executor_type = 
    default_execution_context_type::executor_type;

Default executor type.

using is_execution_context_for

Defined in header <futures/executor/is_execution_context.hpp>

template <class E, class F>
using is_execution_context_for = 
    std::bool_constant< execution_context_for< E, F > >;

Determine if type is an execution context for the specified type of task.

using is_execution_context

Defined in header <futures/executor/is_execution_context.hpp>

template <class E>
using is_execution_context = 
    std::bool_constant< execution_context< E > >;

Determines if a type is an execution context for invocable types.

using is_executor_for

Defined in header <futures/executor/is_executor.hpp>

template <class E, class F>
using is_executor_for = std::bool_constant< executor_for< E, F > >;

Determine if type is an executor for the specified type of task.

using is_executor

Defined in header <futures/executor/is_executor.hpp>

template <class E>
using is_executor = std::bool_constant< executor< E > >;

Determines if a type is an executor for invocable types.

using future_options

Defined in header <futures/future_options.hpp>

template <class... Args>
using future_options = /* see below */;

using source_location

Defined in header <futures/throw.hpp>

using source_location = std::source_location;

A library type equivalent to std::source_location

Description

The source_location class represents certain information about the source code, such as file names, line numbers, and function names.

See Also: std::source_location

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.

Functions

function operator%

Defined in header <futures/adaptor/bind_executor_to_lambda.hpp>

template <executor Executor, class Function>
requires /* see requirements below */
/* see return type below */
operator%(Executor const & ex, Function && after);

Create a proxy pair with a lambda and an executor.

Parameters

  • after - A callable with the continuation
  • ex - An executor

Return value

A proxy pair to schedule execution

Description

For this operation, we needed an operator with higher precedence than operator>> Our options are: +, -, *, /, %, &, !, ~. Although + seems like an obvious choice, % is the one that leads to less conflict with other functions.

Exception Safety

Basic exception guarantee.

function make_ready_future

Defined in header <futures/adaptor/make_ready_future.hpp>

(1)
basic_future< void, future_options<> >
make_ready_future();
(2)
template <class T>
basic_future< typename std::decay_t< T >, future_options<> >
make_ready_future(T && value);
(3)
template <class T>
basic_future< T &, future_options<> >
make_ready_future(std::reference_wrapper< T > value);
  1. Make a placeholder future object that is ready at construction.
  2. Make a placeholder future object that is ready at construction.
  3. Make a placeholder future object that is ready at construction.

Parameters

  • value - The value for the new future

Return value

A future associated with the shared state that is created.

Exception Safety

Basic exception guarantee.

See Also

function make_exceptional_future

Defined in header <futures/adaptor/make_ready_future.hpp>

(1)
template <class T =void>
basic_future< T, future_options<> >
make_exceptional_future(std::exception_ptr ex);
(2)
template <class T =void, class E>
basic_future< T, future_options<> >
make_exceptional_future(E ex);
  1. Make a placeholder future object that is ready with an exception from an exception ptr.
  2. Make a placeholder future object that is ready with an exception from an exception ptr.

Parameters

  • ex - The exception for the new future

Return value

A future associated with the shared state that is created.

Exception Safety

Basic exception guarantee.

See Also

function then

Defined in header <futures/adaptor/then.hpp>

(1)
template <future_like Future, class Function>
requires /* see requirements below */
/* see return type below */
then(Future && before, Function && after);
(2)
template <executor Executor, class Function, class Future>
requires /* see requirements below */
/* see return type below */
then(Executor const & ex, Future && before, Function && after);
  1. Schedule a continuation function to a future.
  2. Schedule a continuation function to a future.

Parameters

  • after - The continuation callable
  • before - The antecedent future
  • ex - The executor

Return value

  • (1) A continuation to the before future
  • (2) A continuation to the before future

Description

This function creates a continuation that gets executed when the before future is completed. The continuation needs to be invocable with the return type of the previous future.

This function works for all kinds of futures but behavior depends on the input:

  • If the previous future is continuable, attach the function to the continuation list
  • If the previous future is not continuable (such as std::future), post to execution with deferred policy. In both cases, the result becomes a cfuture or jcfuture.

Stop tokens are also propagated:

  • If after function expects a stop token:
    • If previous future is stoppable and not-shared: return jcfuture with shared stop source
    • Otherwise: return jcfuture with new stop source
  • If after function does not expect a stop token:
    • If previous future is stoppable and not-shared: return jcfuture with shared stop source
    • Otherwise: return cfuture with no stop source

Exception Safety

Basic exception guarantee.

function operator>>

Defined in header <futures/adaptor/then.hpp>

(1)
template <future_like Future, class Function>
requires /* see requirements below */
/* see return type below */
operator>>(Future && before, Function && after);
(2)
template <class Executor, class Future, class Function, bool RValue>
requires /* see requirements below */
/* see return type below */
operator>>(
    Future && before, 
    detail::executor_and_callable_reference< Executor, Function, RValue > && after);
  1. Operator to schedule a continuation function to a future.
  2. Schedule a continuation function to a future.

Parameters

  • after - The continuation callable
  • before - The antecedent future

Return value

  • (1) A continuation to the before future
  • (2) A continuation to the before future

Description

This function creates a continuation that gets executed when the before future is completed. The continuation needs to be invocable with the return type of the previous future.

This function works for all kinds of futures but behavior depends on the input:

  • If the previous future is continuable, attach the function to the continuation list
  • If the previous future is not continuable (such as std::future), post to execution with deferred policy. In both cases, the result becomes a cfuture or jcfuture.

Stop tokens are also propagated:

  • If after function expects a stop token:
    • If previous future is stoppable and not-shared: return jcfuture with shared stop source
    • Otherwise: return jcfuture with new stop source
  • If after function does not expect a stop token:
    • If previous future is stoppable and not-shared: return jcfuture with shared stop source
    • Otherwise: return cfuture with no stop source

Exception Safety

Basic exception guarantee.

function when_all

Defined in header <futures/adaptor/when_all.hpp>

(1)
template <class InputIt>
requires /* see requirements below */
when_all_future< __see_below__ >
when_all(InputIt first, InputIt last);
(2)
template <class Range>
requires is_range_v<std::decay_t<Range>>
when_all_future< __see_below__ >
when_all(Range && r);
(3)
template <class... Futures>
requires /* see requirements below */
when_all_future< std::tuple< __see_below__ > >
when_all(Futures &&... futures);
  1. Create a future object that becomes ready when the range of input futures becomes ready.
  2. Create a future object that becomes ready when the range of input futures becomes ready.
  3. Create a future object that becomes ready when the range of input futures becomes ready.

Parameters

  • first, last - Range of futures
  • futures - Instances of future objects
  • r - Range of futures

Return value

Future object of type when_all_future

Description

(1) This function does not participate in overload resolution unless InputIt's value type (i.e., typename std::iter_value_t) is a std::future or std::shared_future.

This overload uses a small vector for avoid further allocations for such a simple operation.

(2) This function does not participate in overload resolution unless the range is_future_like trait.

(3) This function does not participate in overload resolution unless every argument is either a (possibly cv-qualified) shared_future or a cv-unqualified future, as defined by the is_future_like trait.

Exception Safety

Basic exception guarantee.

function operator&&

Defined in header <futures/adaptor/when_all.hpp>

template <class T1, class T2>
requires /* see requirements below */
/* see return type below */
operator&&(T1 && lhs, T2 && rhs);

Create a future object that becomes ready when the range of input futures becomes ready.

Parameters

  • lhs, rhs - Future objects or callables

Return value

when_all_future object that concatenates all futures

Description

Operator&& works for futures and functions (which are converted to futures with the default executor) If the future is a when_all_future itself, then it gets merged instead of becoming a child future of another when_all_future.

When the user asks for f1 && f2 && f3, we want that to return a single future that waits for <f1,f2,f3> rather than a future that wait for two futures <f1,<f2,f3>>.

This emulates the usual behavior we expect from other types with operator&&.

Note that this default behaviour is different from when_all(...), which doesn't merge the when_all_future objects by default, because they are variadic functions and this intention can be controlled explicitly:

  • when_all(f1,f2,f3) -> <f1,f2,f3>
  • when_all(f1,when_all(f2,f3)) -> <f1,<f2,f3>>

Exception Safety

Basic exception guarantee.

function when_any

Defined in header <futures/adaptor/when_any.hpp>

(1)
template <class InputIt>
requires /* see requirements below */
when_any_future< __see_below__ >
when_any(InputIt first, InputIt last);
(2)
template <std::ranges::range Range>
when_any_future< __see_below__ >
when_any(Range && r);
(3)
template <class... Futures>
requires /* see requirements below */
when_any_future< std::tuple< __see_below__ > >
when_any(Futures &&... futures);
  1. Create a future object that becomes ready when any of the futures in the range is ready.
  2. Create a future object that becomes ready when any of the futures in the range is ready.
  3. Create a future object that becomes ready when any of the futures in the range is ready.

Parameters

  • first, last - Range of futures
  • futures - A sequence of future objects
  • r - Range of futures

Return value

Description

(2) This function does not participate in overload resolution unless every argument is future-like.

(3) This function does not participate in overload resolution unless every argument is either a (possibly cv-qualified) std::shared_future or a cv-unqualified std::future.

Exception Safety

Basic exception guarantee.

function operator||

Defined in header <futures/adaptor/when_any.hpp>

template <class T1, class T2>
requires /* see requirements below */
/* see return type below */
operator||(T1 && lhs, T2 && rhs);

Create a future object that becomes ready when any of the futures in the range is ready.

Parameters

  • lhs, rhs - Future objects

Return value

A when_any_future holding all future types

Description

ready operator|| works for futures and functions (which are converted to futures with the default executor) If the future is a when_any_future itself, then it gets merged instead of becoming a child future of another when_any_future.

When the user asks for f1 || f2 || f3, we want that to return a single future that waits for <f1 || f2 || f3> rather than a future that wait for two futures <f1 || <f2 || f3>>.

This emulates the usual behavior we expect from other types with operator||.

Note that this default behaviour is different from `when_any(...), which doesn't merge the when_any_future objects by default, because they are variadic functions and this intention can be controlled explicitly:

  • when_any(f1,f2,f3) -> <f1 || f2 || f3>
  • when_any(f1,when_any(f2,f3)) -> <f1 || <f2 || f3>>

Exception Safety

Basic exception guarantee.

function make_grain_size

Defined in header <futures/algorithm/partitioner/default_partitioner.hpp>

constexpr std::size_t
make_grain_size(std::size_t n);

Determine a reasonable minimum grain size depending on the number of elements in a sequence.

Parameters

  • n - Sequence size

Return value

The recommended grain size for a range of the specified size

Description

The grain size considers the number of threads available. It's never more than 2048 elements.

Exception Safety

Basic exception guarantee.

function make_default_partitioner

Defined in header <futures/algorithm/partitioner/default_partitioner.hpp>

(1)
default_partitioner
make_default_partitioner(size_t n);
(2)
template <std::input_iterator I, std::sentinel_for< I > S>
default_partitioner
make_default_partitioner(I first, S last);
(3)
template <class R>
requires is_input_range_v<R>
default_partitioner
make_default_partitioner(R && r);
  1. Create an instance of the default partitioner with a reasonable grain size for n elements.
  2. Create an instance of the default partitioner with a reasonable grain for the range first, last
  3. Create an instance of the default partitioner with a reasonable grain for the range r

Description

The default partitioner type and parameters might change

Exception Safety

Basic exception guarantee.

function await

Defined in header <futures/await.hpp>

(1)
template <future_like Future>
/* see return type below */
await(Future && f);
(2)
template <future_like... Futures>
/* see return type below */
await(Futures &&... fs);
  1. Wait for future types and retrieve their values.
  2. Wait for future types and retrieve their values as a tuple.

Parameters

  • f - A future object
  • fs - Future objects

Return value

The result of the future object

Description

This syntax is most useful for cases where we are immediately requesting the future result.

The function also makes the syntax optionally a little closer to languages such as javascript.

Notes

This function only participates in overload resolution if all types are futures.

Exception Safety

Basic exception guarantee.

function default_execution_context

Defined in header <futures/executor/default_executor.hpp>

default_execution_context_type &
default_execution_context();

Create an instance of the default execution context.

Return value

Reference to the default execution context for async

Exception Safety

Basic exception guarantee.

function make_default_executor

Defined in header <futures/executor/default_executor.hpp>

default_execution_context_type::executor_type
make_default_executor();

Create an Asio thread pool executor for the default thread pool.

Return value

Executor handle to the default execution context

Description

In the executors notation:

  • Executor: set of rules governing where, when and how to run a function object
    • A thread pool is an execution context for which we can create executors pointing to the pool.
    • The executor rule for the default thread pool executor is to run function objects in the pool and nowhere else.

An executor is:

  • Lightweight and copyable (just references and pointers to the execution context).
  • May be long or short lived.
  • May be customized on a fine-grained basis, such as exception behavior, and order

There might be many executor types associated with with the same execution context.

Exception Safety

Basic exception guarantee.

function execute

Defined in header <futures/executor/execute.hpp>

(1)
template <class F, executor_for< F > E>
void
execute(E const & ex, F && f);
(2)
template <class F, execution_context_for< F > C>
requires /* see requirements below */
void
execute(C & ctx, F && f);
  1. Submits a task for execution.
  2. Submits a task for execution on an execution context.

Parameters

  • ctx - The target execution context
  • ex - The target executor
  • f - The task

Description

(1) This free function submits a task for execution using the specified executor.

Unlike the execute member function of executors, this function identifies and interoperates with other executor types, such as Asio executors. If an execution context is provided, its executor is retrived and used instead.

(2) This free function submits a task for execution using the specified execution context.

This is a convenience function that extracts the executor from the context and uses it instead.

Exception Safety

Basic exception guarantee.

function hardware_concurrency

Defined in header <futures/executor/hardware_concurrency.hpp>

unsigned int
hardware_concurrency() noexcept;

A version of hardware_concurrency that always returns at least 1.

Return value

Number of concurrent threads supported. If the value is not well-defined or not computable, returns 1.

Description

This function is a safer version of hardware_concurrency that always returns at least 1 to represent the current context when the value is not computable.

  • It never returns 0, 1 is returned instead.
  • It is guaranteed to remain constant for the duration of the program.

It also improves on hardware_concurrency to provide a default value of 1 when the function is being executed at compile time. This allows partitioners and algorithms to be constexpr.

Exception Safety

Throws nothing.

See Also

function make_inline_executor

Defined in header <futures/executor/inline_executor.hpp>

constexpr inline_executor
make_inline_executor();

Make an inline executor object.

Exception Safety

Basic exception guarantee.

function make_new_thread_executor

Defined in header <futures/executor/new_thread_executor.hpp>

constexpr new_thread_executor
make_new_thread_executor();

Make an new thread executor object.

Exception Safety

Basic exception guarantee.

function is_ready

Defined in header <futures/is_ready.hpp>

template <future_like Future>
bool
is_ready(Future && f);

Check if a future is ready.

Description

Although basic_future has its more efficient is_ready function, this free function allows us to query other futures that don't implement is_ready, such as std::future.

Exception Safety

Basic exception guarantee.

function async

Defined in header <futures/launch.hpp>

(1)
template <executor Executor, class Function, class... Args>
requires /* see requirements below */
/* see return type below */
async(Executor const & ex, Function && f, Args &&... args);
(2)
template <class Function, class... Args>
requires /* see requirements below */
/* see return type below */
async(Function && f, Args &&... args);
  1. Launch an asynchronous task with the specified executor.
  2. Launch an asynchronous task with the default executor.

Template Parameters

  • Args - Arguments for the Function
  • Executor - Executor from an execution context
  • Function - A callable object

Parameters

  • args - Function arguments
  • ex - Executor
  • f - Function to execute

Return value

  • (1) A future object with the function results
  • (2) An eager future object whose shared state refers to the task result. The type of this future object depends on the task. If the task expects a stop_token, the future will return a continuable, stoppable, eager future. Otherwise, the function will return a continuable eager future.

Description

This version of the async function will always use the specified executor instead of creating a new thread.

If no executor is provided, then the function is run in a default executor created from the default thread pool. The default executor also ensures the function will not launch one thread per task.

The task might accept a stop token as its first parameter, in which case the function returns a continuable and stoppable future type. Otherwise, this function returns a continuable future type.

Example

auto f = async(ex, []() { return 2; });
std::cout << f.get() << std::endl; // 2

Exception Safety

Basic exception guarantee.

See Also

function schedule

Defined in header <futures/launch.hpp>

(1)
template <executor Executor, class Function, class... Args>
requires /* see requirements below */
/* see return type below */
schedule(Executor const & ex, Function && f, Args &&... args);
(2)
template <class Function, class... Args>
requires /* see requirements below */
/* see return type below */
schedule(Function && f, Args &&... args);
  1. Schedule an asynchronous task with the specified executor.
  2. Schedule an asynchronous task with the default executor.

Template Parameters

  • Args - Arguments for the Function
  • Executor - Executor from an execution context
  • Function - A callable object

Parameters

  • args - Function arguments
  • ex - Executor
  • f - Function to execute

Return value

  • (1) A deferred future object whose shared state refers to the task result. The type of this future object depends on the task. If the task expects a stop_token, the future will return a stoppable deferred future. Otherwise, the function will return a deferred future.
  • (2) A future object with the function results

Description

This function schedules a deferred future. The task will only be launched in the executor when some other execution context waits for the value associated to this future.

Exception Safety

Basic exception guarantee.

See Also

function swap

Defined in headers <futures/packaged_task.hpp>, <futures/promise.hpp>

(1)
template <typename Signature>
void
swap(
    packaged_task< Signature > & l, 
    packaged_task< Signature > & r) noexcept;
(2)
template <typename R>
void
swap(promise< R > & l, promise< R > & r) noexcept;
  1. Specializes the std::swap algorithm.
  2. Swap the value of two promises.

Exception Safety

Throws nothing.

function handle_exception

Defined in header <futures/throw.hpp>

void
handle_exception(std::exception const &, boost::source_location const &);

Customization point to handle exceptions.

Description

When exception support is disabled with [FUTURES_NO_EXCEPTIONS], this function will be called to handle exceptions.

To customize how exceptions will be handled, define the macro [FUTURES_CUSTOM_EXCEPTION_HANDLE], and define an alternative implementation for this function.

Exception Safety

Basic exception guarantee.

function throw_exception

Defined in header <futures/throw.hpp>

template <class E>
void
throw_exception(
    E && e, 
    source_location const & loc =std::source_location::current());

Library function used to throw exceptions.

Template Parameters

  • E - Exception type

Parameters

  • e - Exception object
  • loc - Location where the exception occurred

Description

This is the main library function used to throw exceptions according to the functions available for handling exceptions.

Exception Safety

Basic exception guarantee.

function wait_for_all

Defined in header <futures/wait_for_all.hpp>

(1)
template <std::input_iterator Iterator>
requires future_like<std::iter_value_t<Iterator>>
void
wait_for_all(Iterator first, Iterator last);
(2)
template <std::ranges::range Range>
requires future_like<std::ranges::range_value_t<Range>>
void
wait_for_all(Range && r);
(3)
template <future_like... Fs>
void
wait_for_all(Fs &&... fs);
(4)
template <class Tuple>
requires /* see requirements below */
void
wait_for_all(Tuple && t);

Wait for a sequence of futures to be ready.

Template Parameters

  • Fs - A list of future types
  • Iterator - Iterator type in a range of futures
  • Range - A range of futures type

Parameters

  • first - Iterator to the first element in the range
  • fs - A list of future objects
  • last - Iterator to one past the last element in the range
  • r - Range of futures

Description

(1) This function waits for all futures in the range [first, last) to be ready. It simply waits iteratively for each of the futures to be ready.

(2) This function waits for all futures in the range r to be ready. It simply waits iteratively for each of the futures to be ready.

(3) This function waits for all specified futures fs... to be ready.

It creates a compile-time fixed-size data structure to store references to all of the futures and then waits for each of the futures to be ready.

Notes

This function is adapted from boost::wait_for_all

Exception Safety

Basic exception guarantee.

See Also

function wait_for_all_for

Defined in header <futures/wait_for_all.hpp>

(1)
template <class Iterator, class Rep, class Period>
requires is_future_like_v<iter_value_t<Iterator>>
future_status
wait_for_all_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Iterator first, 
    Iterator last);
(2)
template <class Range, class Rep, class Period>
requires is_range_v<Range> && is_future_like_v<range_value_t<Range>>
future_status
wait_for_all_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Range && r);
(3)
template <future_like... Fs, class Rep, class Period>
future_status
wait_for_all_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Fs &&... fs);
(4)
template <class Tuple, class Rep, class Period>
requires /* see requirements below */
future_status
wait_for_all_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Tuple && t);

Wait for a sequence of futures to be ready.

Template Parameters

  • Fs - Range of futures
  • Iterator - Iterator type in a range of futures
  • Period - Duration Period
  • Range - Range of futures
  • Rep - Duration Rep
  • Tuple - Tuple of futures

Parameters

  • first - Iterator to the first element in the range
  • fs - Future objects
  • last - Iterator to one past the last element in the range
  • r - Range of futures
  • t - Tuple of futures
  • timeout_duration - Time to wait for

Return value

future_status::ready if all futures got ready. future_status::timeout otherwise.

Exception Safety

Basic exception guarantee.

function wait_for_all_until

Defined in header <futures/wait_for_all.hpp>

(1)
template <std::input_iterator Iterator, class Clock, class Duration>
requires future_like<std::iter_value_t<Iterator>>
future_status
wait_for_all_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Iterator first, 
    Iterator last);
(2)
template <std::ranges::range Range, class Clock, class Duration>
requires future_like<range_value_t<Range>>
future_status
wait_for_all_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Range && r);
(3)
template <future_like... Fs, class Clock, class Duration>
future_status
wait_for_all_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Fs &&... fs);
(4)
template <class Tuple, class Clock, class Duration>
requires /* see requirements below */
future_status
wait_for_all_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Tuple && t);

Wait for a sequence of futures to be ready.

Template Parameters

  • Clock - Time point clock
  • Duration - Time point duration
  • Fs - Future objects
  • Iterator - Iterator type in a range of futures
  • Range - Range of futures
  • Tuple - Tuple of futures

Parameters

  • first - Iterator to the first element in the range
  • fs - Future objects
  • last - Iterator to one past the last element in the range
  • r - Range of futures
  • t - Tuple of futures
  • timeout_time - Limit time point

Return value

future_status::ready if all futures got ready. future_status::timeout otherwise.

Exception Safety

Basic exception guarantee.

function wait_for_any

Defined in header <futures/wait_for_any.hpp>

(1)
template <std::input_iterator Iterator>
requires future_like<iter_value_t<Iterator>>
Iterator
wait_for_any(Iterator first, Iterator last);
(2)
template <std::ranges::range Range>
requires future_like<range_value_t<Range>>
iterator_t< Range >
wait_for_any(Range && r);
(3)
template <future_like... Fs>
std::size_t
wait_for_any(Fs &&... fs);
(4)
template <class Tuple>
requires /* see requirements below */
std::size_t
wait_for_any(Tuple && t);
  1. Wait for any future in a sequence to be ready.
  2. Wait for any future in a sequence to be ready.
  3. Wait for any future in a sequence to be ready.
  4. Wait for any future in a tuple to be ready.

Template Parameters

  • Fs - A list of future types
  • Iterator - Iterator type in a range of futures

Parameters

  • first - Iterator to the first element in the range
  • fs - A list of future objects
  • last - Iterator to one past the last element in the range
  • r - Range of futures
  • t - A list of future objects

Return value

  • (1) Index of the first future that got ready
  • (2) Iterator to the first future that got ready

Description

(1) This function waits for any future in the range [first, last) to be ready.

Unlike wait_for_all, this function requires special data structures to allow that to happen without blocking.

For disjunctions, we have few options:

  • If the input futures support external notifiers:
    • Attach continuations to notify when a task is over
  • If the input futures do not have lazy continuations:
    • Polling in a busy loop until one of the futures is ready
    • Polling with exponential backoffs until one of the futures is ready
    • Launching n continuation tasks that set a promise when one of the futures is ready
    • Hybrids, usually polling for short tasks and launching threads for other tasks
  • If the input futures are mixed in regards to lazy continuations:
    • Mix the strategies above, depending on each input future

If the thresholds for these strategies are reasonable, this should be efficient for futures with or without lazy continuations.

(2) This function waits for any future in the range r to be ready. This function requires special data structures to allow that to happen without blocking.

(3) This function waits for all specified futures fs... to be ready.

(4) This function waits for all specified futures fs... to be ready.

Notes

This function is adapted from boost::wait_for_any

Exception Safety

Basic exception guarantee.

See Also

function wait_for_any_for

Defined in header <futures/wait_for_any.hpp>

(1)
template <std::input_iterator Iterator, class Rep, class Period>
requires future_like<iter_value_t<Iterator>>
Iterator
wait_for_any_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Iterator first, 
    Iterator last);
(2)
template <std::ranges::range Range, class Rep, class Period>
requires future_like<std::ranges::range_value_t<Range>>
iterator_t< Range >
wait_for_any_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Range && r);
(3)
template <future_like... Fs, class Rep, class Period>
std::size_t
wait_for_any_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Fs &&... fs);
(4)
template <class Tuple, class Rep, class Period>
requires /* see requirements below */
std::size_t
wait_for_any_for(
    std::chrono::duration< Rep, Period > const & timeout_duration, 
    Tuple && t);

Wait for any future in a sequence to be ready.

Template Parameters

  • Fs - Future types
  • Iterator - Iterator type in a range of futures
  • Period - Duration Period
  • Range - Iterator type in a range of futures
  • Rep - Duration Rep
  • Tuple - Tuple of futures

Parameters

  • first - Iterator to the first element in the range
  • fs - Future objects
  • last - Iterator to one past the last element in the range
  • r - Range of futures
  • t - tuple of futures
  • timeout_duration - Time to wait for

Return value

  • (1) Index of the future which got ready
  • (2) Iterator to the future which got ready

Exception Safety

Basic exception guarantee.

function wait_for_any_until

Defined in header <futures/wait_for_any.hpp>

(1)
template <std::input_iterator Iterator, class Clock, class Duration>
requires future_like<iter_value_t<Iterator>>
Iterator
wait_for_any_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Iterator first, 
    Iterator last);
(2)
template <std::ranges::range Range, class Clock, class Duration>
requires future_like<range_value_t<Range>>
iterator_t< Range >
wait_for_any_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Range && r);
(3)
template <future_like... Fs, class Clock, class Duration>
std::size_t
wait_for_any_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Fs &&... fs);
(4)
template <class Tuple, class Clock, class Duration>
requires /* see requirements below */
std::size_t
wait_for_any_until(
    std::chrono::time_point< Clock, Duration > const & timeout_time, 
    Tuple && t);

Wait for any future in a sequence to be ready.

Template Parameters

  • Clock - Time point clock
  • Duration - Time point duration
  • Fs - Future types
  • Iterator - Iterator type in a range of futures
  • Range - Range of futures
  • Tuple - Tuple of future types

Parameters

  • first - Iterator to the first element in the range
  • fs - Future objects
  • last - Iterator to one past the last element in the range
  • r - Range of futures
  • t - Tuple of future objects
  • timeout_time - Limit time point

Return value

  • (1) Index of the future which got ready
  • (2) Iterator to the future which got ready

Exception Safety

Basic exception guarantee.

Attributes

variable all_of

Defined in header <futures/algorithm/all_of.hpp>

constexpr all_of_functor all_of;

Checks if a predicate is true for all the elements in a range.

variable any_of

Defined in header <futures/algorithm/any_of.hpp>

constexpr any_of_functor any_of;

Checks if a predicate is true for any of the elements in a range.

variable count

Defined in header <futures/algorithm/count.hpp>

constexpr count_functor count;

Returns the number of elements matching an element.

variable count_if

Defined in header <futures/algorithm/count_if.hpp>

constexpr count_if_functor count_if;

Returns the number of elements satisfying specific criteria.

variable find

Defined in header <futures/algorithm/find.hpp>

constexpr find_functor find;

Finds the first element equal to another element.

variable find_if

Defined in header <futures/algorithm/find_if.hpp>

constexpr find_if_functor find_if;

Finds the first element satisfying specific criteria.

variable find_if_not

Defined in header <futures/algorithm/find_if_not.hpp>

constexpr find_if_not_functor find_if_not;

Finds the first element not satisfying specific criteria.

variable for_each

Defined in header <futures/algorithm/for_each.hpp>

constexpr for_each_functor for_each;

Applies a function to a range of elements.

variable none_of

Defined in header <futures/algorithm/none_of.hpp>

constexpr none_of_functor none_of;

Checks if a predicate is true for none of the elements in a range.

variable is_partitioner_for_v

Defined in header <futures/algorithm/partitioner/partitioner_for.hpp>

constexpr bool is_partitioner_for_v = is_partitioner_for<P, I, S>::value;

Determine if P is a valid partitioner for the iterator range [I,S].

variable seq

Defined in header <futures/algorithm/policies.hpp>

constexpr sequenced_policy seq {};

Tag used in algorithms for a sequenced_policy.

variable par

Defined in header <futures/algorithm/policies.hpp>

constexpr parallel_policy par {};

Tag used in algorithms for a parallel_policy.

variable par_unseq

Defined in header <futures/algorithm/policies.hpp>

constexpr parallel_unsequenced_policy par_unseq {};

Tag used in algorithms for a parallel_unsequenced_policy.

variable unseq

Defined in header <futures/algorithm/policies.hpp>

constexpr unsequenced_policy unseq {};

Tag used in algorithms for an unsequenced_policy.

variable is_execution_policy_v

Defined in header <futures/algorithm/policies.hpp>

constexpr bool is_execution_policy_v = is_execution_policy<T>::value;

Determines whether T is a standard or implementation-defined execution policy type.

variable reduce

Defined in header <futures/algorithm/reduce.hpp>

constexpr reduce_functor reduce;

Sums up (or accumulate with a custom function) a range of elements, except out of order.

variable is_assignable_from_v

Defined in header <futures/algorithm/traits/is_assignable_from.hpp>

constexpr bool is_assignable_from_v = is_assignable_from<LHS, RHS>::value;

A type trait equivalent to the std::assignable_from concept.

See Also: std::assignable_from

variable is_bidirectional_iterator_v

Defined in header <futures/algorithm/traits/is_bidirectional_iterator.hpp>

constexpr bool is_bidirectional_iterator_v = is_bidirectional_iterator<
        I>::value;

A type trait equivalent to the std::bidirectional_iterator concept.

See Also: std::bidirectional_iterator

variable is_constructible_from_v

Defined in header <futures/algorithm/traits/is_constructible_from.hpp>

constexpr bool is_constructible_from_v = is_constructible_from<T>::value;

A type trait equivalent to the std::constructible_from concept.

See Also: std::constructible_from

variable is_convertible_to_v

Defined in header <futures/algorithm/traits/is_convertible_to.hpp>

constexpr bool is_convertible_to_v = is_convertible_to<From, To>::value;

A type trait equivalent to the std::convertible_to concept.

See Also: std::convertible_to

variable is_copyable_v

Defined in header <futures/algorithm/traits/is_copyable.hpp>

constexpr bool is_copyable_v = is_copyable<T>::value;

A type trait equivalent to the std::copyable concept.

See Also: std::copyable

variable is_default_initializable_v

Defined in header <futures/algorithm/traits/is_default_initializable.hpp>

constexpr bool is_default_initializable_v = is_default_initializable<
        T>::value;

A type trait equivalent to the std::default_initializable concept.

See Also: std::default_initializable

variable is_derived_from_v

Defined in header <futures/algorithm/traits/is_derived_from.hpp>

constexpr bool is_derived_from_v = is_derived_from<Derived, Base>::value;

A type trait equivalent to the derived_from concept.

See Also: std::derived_from

variable is_equality_comparable_v

Defined in header <futures/algorithm/traits/is_equality_comparable.hpp>

constexpr bool is_equality_comparable_v = is_equality_comparable<T>::value;

A type trait equivalent to the std::equality_comparable concept.

See Also: std::equality_comparable

variable is_equality_comparable_with_v

Defined in header <futures/algorithm/traits/is_equality_comparable_with.hpp>

constexpr bool is_equality_comparable_with_v = is_equality_comparable_with<T, U>::value;

A type trait equivalent to the std::equality_comparable_with concept.

See Also: std::equality_comparable_with

variable is_forward_iterator_v

Defined in header <futures/algorithm/traits/is_forward_iterator.hpp>

constexpr bool is_forward_iterator_v = is_forward_iterator<I>::value;

A type trait equivalent to the std::forward_iterator concept.

See Also: std::forward_iterator

variable is_incrementable_v

Defined in header <futures/algorithm/traits/is_incrementable.hpp>

constexpr bool is_incrementable_v = is_incrementable<I>::value;

A type trait equivalent to the std::incrementable concept.

See Also: std::incrementable

variable is_indirectly_binary_invocable_v

Defined in header <futures/algorithm/traits/is_indirectly_binary_invocable.hpp>

constexpr bool is_indirectly_binary_invocable_v = is_indirectly_binary_invocable<F, I1, I2>::value;

Determine if a function can be invoke with the value type of both iterators.

variable is_indirectly_readable_v

Defined in header <futures/algorithm/traits/is_indirectly_readable.hpp>

constexpr bool is_indirectly_readable_v = is_indirectly_readable<T>::value;

A type trait equivalent to the std::indirectly_readable concept.

See Also: std::indirectly_readable

variable is_indirectly_unary_invocable_v

Defined in header <futures/algorithm/traits/is_indirectly_unary_invocable.hpp>

constexpr bool is_indirectly_unary_invocable_v = is_indirectly_unary_invocable<F, I>::value;

A type trait equivalent to the std::indirectly_unary_invocable concept.

See Also: std::indirectly_unary_invocable

variable is_input_iterator_v

Defined in header <futures/algorithm/traits/is_input_iterator.hpp>

constexpr bool is_input_iterator_v = is_input_iterator<T>::value;

A type trait equivalent to the std::input_iterator concept.

See Also: std::input_iterator

variable is_input_or_output_iterator_v

Defined in header <futures/algorithm/traits/is_input_or_output_iterator.hpp>

constexpr bool is_input_or_output_iterator_v = is_input_or_output_iterator<
        T>::value;

A type trait equivalent to the std::is_input_or_output_iterator concept.

See Also: std::is_input_or_output_iterator

variable is_input_range_v

Defined in header <futures/algorithm/traits/is_input_range.hpp>

bool constexpr is_input_range_v = is_input_range<T>::value;

A type trait equivalent to the std::input_range concept.

See Also: std::ranges::input_range

variable is_movable_v

Defined in header <futures/algorithm/traits/is_movable.hpp>

constexpr bool is_movable_v = is_movable<T>::value;

A type trait equivalent to the std::movable concept.

See Also: std::movable

variable is_move_constructible_v

Defined in header <futures/algorithm/traits/is_move_constructible.hpp>

constexpr bool is_move_constructible_v = is_move_constructible<T>::value;

A type trait equivalent to the std::move_constructible concept.

See Also: std::move_constructible

variable is_random_access_iterator_v

Defined in header <futures/algorithm/traits/is_random_access_iterator.hpp>

constexpr bool is_random_access_iterator_v = is_random_access_iterator<
        I>::value;

A type trait equivalent to the std::random_access_iterator concept.

See Also: std::random_access_iterator

variable is_range_v

Defined in header <futures/algorithm/traits/is_range.hpp>

constexpr bool is_range_v = is_range<T>::value;

A type trait equivalent to the std::range concept.

See Also: std::ranges::range

variable is_regular_v

Defined in header <futures/algorithm/traits/is_regular.hpp>

constexpr bool is_regular_v = is_regular<T>::value;

A type trait equivalent to the std::regular concept.

See Also: std::regular

variable is_semiregular_v

Defined in header <futures/algorithm/traits/is_semiregular.hpp>

constexpr bool is_semiregular_v = is_semiregular<T>::value;

A type trait equivalent to the std::semiregular concept.

See Also: std::semiregular

variable is_sentinel_for_v

Defined in header <futures/algorithm/traits/is_sentinel_for.hpp>

constexpr bool is_sentinel_for_v = is_sentinel_for<S, I>::value;

A type trait equivalent to the std::sentinel_for concept.

See Also: std::sentinel_for

variable is_swappable_v

Defined in header <futures/algorithm/traits/is_swappable.hpp>

constexpr bool is_swappable_v = is_swappable<T>::value;

A type trait equivalent to the std::swappable concept.

See Also: std::swappable

variable is_three_way_comparable_v

Defined in header <futures/algorithm/traits/is_three_way_comparable.hpp>

constexpr bool is_three_way_comparable_v = is_three_way_comparable<T>::value;

A type trait equivalent to the std::equality_comparable concept.

See Also: std::three_way_comparable

variable is_three_way_comparable_with_v

Defined in header <futures/algorithm/traits/is_three_way_comparable_with.hpp>

constexpr bool is_three_way_comparable_with_v = is_three_way_comparable_with<T, U>::value;

A type trait equivalent to the std::equality_comparable_with concept.

See Also: std::three_way_comparable

variable is_totally_ordered_v

Defined in header <futures/algorithm/traits/is_totally_ordered.hpp>

constexpr bool is_totally_ordered_v = is_totally_ordered<T>::value;

A type trait equivalent to the std::totally_ordered concept.

See Also: std::totally_ordered

variable is_totally_ordered_with_v

Defined in header <futures/algorithm/traits/is_totally_ordered_with.hpp>

constexpr bool is_totally_ordered_with_v = is_totally_ordered_with<T, U>::
        value;

A type trait equivalent to the std::totally_ordered_with concept.

See Also: std::totally_ordered

variable is_weakly_incrementable_v

Defined in header <futures/algorithm/traits/is_weakly_incrementable.hpp>

constexpr bool is_weakly_incrementable_v = is_weakly_incrementable<I>::value;

A type trait equivalent to the std::weakly_incrementable concept.

See Also: std::weakly_incrementable

variable is_execution_context_for_v

Defined in header <futures/executor/is_execution_context.hpp>

constexpr bool is_execution_context_for_v = execution_context_for<E, F>;

Determine if type is an execution context for the specified type of task.

variable is_execution_context_v

Defined in header <futures/executor/is_execution_context.hpp>

constexpr bool is_execution_context_v = execution_context<E>;

Determines if a type is an execution context for invocable types.

variable is_executor_for_v

Defined in header <futures/executor/is_executor.hpp>

constexpr bool is_executor_for_v = executor_for<E, F>;

Determine if type is an executor for the specified type of task.

variable is_executor_v

Defined in header <futures/executor/is_executor.hpp>

constexpr bool is_executor_v = executor<E>;

Determines if a type is an executor for invocable types.

variable nostopstate

Defined in header <futures/stop_token.hpp>

constexpr nostopstate_t nostopstate {};

Empty struct to initialize a stop_source without a shared stop state.

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 execution_policy

Defined in header <futures/algorithm/policies.hpp>

template<class E>
concept execution_policy = is_execution_policy_v<E>;

Determines if a type is an execution_policy.

concept partitioner_for

Defined in header <futures/algorithm/partitioner/partitioner_for.hpp>

template<class P, class I, class S I>
concept partitioner_for = std::input_iterator<I> && std::sentinel_for<S, I>
                              && std::invocable<P, I, S>;

Determines if a type is an partitioner.

concept execution_context_for

Defined in header <futures/executor/is_execution_context.hpp>

template<class C, class F>
concept execution_context_for = 
        requires(C ctx, F f) {
            { ctx.get_executor() } -> executor_for<F>;
        };

Determines if a type is an execution context for the a task type.

concept execution_context

Defined in header <futures/executor/is_execution_context.hpp>

template<class C>
concept execution_context = execution_context_for<C, __invocable_archetype__ >;

The invocable archetype task is a regular functor.

Description

This means this trait should work for any execution context that supports non-heterogeneous tasks.

concept executor_for

Defined in header <futures/executor/is_executor.hpp>

template<class E, class F>
concept executor_for = requires(E e, F f) { e.execute(f); };

Determines if a type is an executor for the specified type of task.

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.

concept executor

Defined in header <futures/executor/is_executor.hpp>

template<class E>
concept executor = executor_for<E, __invocable_archetype__ >;

The invocable archetype task is a regular functor.

Description

Determines if a type is an executor for invocable types.

Determines if a type is an execution context for invocable types.

This means this trait should work for any executor that supports non-heterogeneous tasks.


Updated on 2023-01-04