boost::capy::when_all

when_all overloads

Synopses

Declared in <boost/capy/when_all.hpp>

Execute results‐returning awaitables concurrently, inspecting error codes.

template<ContextAwaitable... As>
requires (sizeof...(As) > 0)
          && detail::all_results_awaitables<As...>
[[nodiscard]]
task<results</* implementation-defined */...>>
when_all(As... awaitables);

Execute a range of results‐returning awaitables concurrently.

template<ContextAwaitableRange R>
requires detail::is_results_v<
        awaitable_result_t<std::ranges::range_value_t<R>>>
    && (!std::is_same_v<
            detail::results_payload_t<
                awaitable_result_t<std::ranges::range_value_t<R>>>,
            std::tuple<>>)
[[nodiscard]]
task<results<std::vector</* implementation-defined */>>>
when_all(R&& awaitables);

Execute a range of void results‐returning awaitables concurrently.

template<ContextAwaitableRange R>
requires detail::is_results_v<
        awaitable_result_t<std::ranges::range_value_t<R>>>
    && std::is_same_v<
            detail::results_payload_t<
                awaitable_result_t<std::ranges::range_value_t<R>>>,
            std::tuple<>>
[[nodiscard]]
task<results<>>
when_all(R&& awaitables);

Exceptions

Name

Thrown on

std::invalid_argument

if range is empty (thrown before coroutine suspends).

Return Value

  • A task yielding results<R1, R2, ..., Rn> where each Ri follows the payload flattening rules.

  • A task yielding results<vector<PayloadT>> where PayloadT is the payload extracted from each child's results.

  • A task yielding results<> whose ec is the first child error, or default‐constructed on success.

The return value should not be discarded.

Parameters

Name

Description

awaitables

One or more awaitables each returning results<Ts...>.

See Also