YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
join.hpp
Go to the documentation of this file.
1#pragma once
2
7
8namespace yaclib {
9
10template <FailPolicy F = FailPolicy::None, typename... Futures,
11 typename = std::enable_if_t<(... && is_combinator_input_v<Futures>)>>
14 return when::When<when::Join, F, void, typename head_t<Futures...>::Core::Error>(std::move(futures)...);
15}
16
18YACLIB_INLINE auto Join(It begin, std::size_t count) {
19 return when::When<when::Join, F, void, typename T::Core::Error>(begin, count);
20}
21
24 // We don't use std::distance because we want to alert the user to the fact that it can be expensive.
25 // Maybe the user has the size of the range, otherwise it is suggested to call WhenAny(begin, distance(begin, end))
26 return Join<F>(begin, static_cast<std::size_t>(end - begin));
27}
28
29}; // namespace yaclib
auto When(Futures... futures)
Definition when.hpp:318
YACLIB_INLINE void CheckSameError()
Definition when.hpp:20
typename detail::Head< Args... >::Type head_t
YACLIB_INLINE auto Join(Futures... futures)
Definition join.hpp:12
FailPolicy
This Policy describe how algorithm interpret if Future will be fulfilled by fail (exception or error)
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25