YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
join.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
yaclib/async/when/join.hpp
>
4
#include <
yaclib/async/when/when.hpp
>
5
#include <
yaclib/util/fail_policy.hpp
>
6
#include <
yaclib/util/type_traits.hpp
>
7
8
namespace
yaclib
{
9
10
template
<
FailPolicy
F =
FailPolicy::None
,
typename
...
Futures
,
11
typename
= std::enable_if_t<(... &&
is_combinator_input_v<Futures>
)>>
12
YACLIB_INLINE
auto
Join
(
Futures
...
futures
) {
13
when::CheckSameError
<
Futures
...>();
14
return
when::When
<
when::Join
, F,
void
,
typename
head_t
<
Futures
...>::Core::Error>(std::move(
futures
)...);
15
}
16
17
template <FailPolicy F = FailPolicy::None, typename It, typename T = typename std::iterator_traits<It>::value_type
>
18
YACLIB_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
22
template <FailPolicy F = FailPolicy::None, typename It, typename T = typename std::iterator_traits<It>::value_type
>
23
YACLIB_INLINE
auto
Join
(
It
begin
,
It
end
) {
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
fail_policy.hpp
yaclib::when::When
auto When(Futures... futures)
Definition
when.hpp:318
yaclib::when::CheckSameError
YACLIB_INLINE void CheckSameError()
Definition
when.hpp:20
yaclib
Definition
base_core.hpp:15
yaclib::head_t
typename detail::Head< Args... >::Type head_t
Definition
type_traits.hpp:18
yaclib::Join
YACLIB_INLINE auto Join(Futures... futures)
Definition
join.hpp:12
yaclib::FailPolicy
FailPolicy
This Policy describe how algorithm interpret if Future will be fulfilled by fail (exception or error)
Definition
fail_policy.hpp:12
yaclib::FailPolicy::None
@ None
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
yaclib::when::Join
Definition
join.hpp:13
type_traits.hpp
join.hpp
when.hpp
include
yaclib
async
join.hpp
Generated by
1.9.8