einsums::task_pool::when_all#

Note

Generated from the C++ headers by apiary --emit-cpp-docs-json.

Defined in header Einsums/TaskPool/TaskHandle.hpp.

template<typename T>
TaskHandle<std::vector<T>> when_all(std::vector<TaskHandle<T>> handles)#

Fan-in: returns a handle that completes when all input handles complete.

TaskHandle<void> when_all(std::vector<TaskHandle<void>> handles)#

Fan-in for void handles.

template<typename ...Ts>
TaskHandle<std::tuple<Ts...>> when_all(TaskHandle<Ts>... handles)#

Variadic when_all: returns TaskHandle<std::tuple<T1, T2, …>>.

Completes when ALL input handles are ready. The result tuple contains the values in the same order as the input handles.

auto a = pool.submit("a", []() { return 42; });
auto b = pool.submit("b", []() { return 3.14; });
auto combined = when_all(a, b);
auto [x, y] = combined.get();  // x=42, y=3.14