[#join] == cobalt/join.hpp The `join` function can be used to `co_await` multiple <> at once with properly connected cancellations. The function will gather all completion and return them as values, unless an exception is thrown. If an exception is thrown, all outstanding ops are cancelled (or interrupted if possible) and the first exception gets rethrown. NOTE: `void` will be returned as `variant2::monostate` in the tuple, unless all awaitables yield void. It can be called as a variadic function with multiple <> or as on a range of <>. [source,cpp] ---- cobalt::promise task1(); cobalt::promise task2(); cobalt::promise do_join() { co_await cobalt::join(task1(), task2()); // <1> std::vector> aws {task1(), task2()}; co_await cobalt::join(aws); // <2> } ---- <1> Wait for a variadic set of <> <2> Wait for a vector of <> The `join` will invoke the functions of the `awaitable` as if used in a `co_await` expression. .Signatures of join [source, cpp] ---- extern promise pv1, pv2; /* void */ co_await join(pv1, pv2); std::vector> pvv; /* void */ co_await join(pvv); extern promise pi1, pi2; std::tuple r1 = co_await join(pv1, pv2, pi1, pi2); std::vector> piv; pmr::vector r2 = co_await join(piv); ---- [#join-outline] === Outline [source,cpp,subs=+quotes] ---- // Variadic join template __awaitable__ join(Promise && ... p); // Ranged join template> __awaitable__ join(PromiseRange && p); ---- NOTE: Selecting an on empty range will cause an exception.