C/C++ API Reference
Loading...
Searching...
No Matches
Combinators

Overview

Helpers for interacting with multiples futures.

Learn more: Combinators

Classes

class  pw::async2::JoinFuture< Futures >
 
class  pw::async2::SelectFuture< Futures >
 

Functions

template<typename... Futures>
 pw::async2::JoinFuture (Futures &&...) -> JoinFuture< Futures... >
 
template<typename... Futures>
constexpr auto pw::async2::Join (Futures &&... futures)
 
template<typename... Futures>
 pw::async2::SelectFuture (Futures &&...) -> SelectFuture< Futures... >
 
template<typename... Futures>
SelectFuture< Futures... > pw::async2::Select (Futures &&... futures)
 

Function Documentation

◆ Join()

template<typename... Futures>
constexpr auto pw::async2::Join ( Futures &&...  futures)
constexpr

Creates a future which pends the provided futures until all of them have completed.

When ready, the resulting future returns a tuple containing each future's output in the order the futures were provided.

◆ Select()

template<typename... Futures>
SelectFuture< Futures... > pw::async2::Select ( Futures &&...  futures)

Runs each of the provided futures, resolving once the first has completed.

As additional futures may have completed during the time between the first completion and the task running, Select returns a Future<OptionalTuple> which stores the results of all the sub-futures which managed to complete.