YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
await_on.hpp
Go to the documentation of this file.
1#pragma once
2
7
8namespace yaclib {
9
10template <typename... V, typename... E>
12 return detail::AwaitOnAwaiter<sizeof...(fs) == 1>{e, UpCast<detail::BaseCore>(*fs.GetCore())...};
13}
14
15/**
16 * TODO(mkornaukhov03) Add doxygen docs
17 */
18template <typename Iterator>
19YACLIB_INLINE auto AwaitOn(IExecutor& e, Iterator begin, std::size_t count) noexcept
20 -> std::enable_if_t<!is_future_base_v<Iterator>, detail::AwaitOnAwaiter<false>> {
22}
23
24/**
25 * TODO(mkornaukhov03) Add doxygen docs
26 */
27template <typename BeginIt, typename EndIt>
29 -> std::enable_if_t<!is_future_base_v<BeginIt>, detail::AwaitOnAwaiter<false>> {
30 // We don't use std::distance because we want to alert the user to the fact that it can be expensive.
31 // Maybe the user has the size of the range, otherwise it is suggested to call Await(begin, distance(begin, end))
32 return AwaitOn(e, begin, static_cast<std::size_t>(end - begin));
33}
34
35} // namespace yaclib
Provides a mechanism to access the result of async operations.
Definition future.hpp:20
YACLIB_INLINE auto AwaitOn(IExecutor &e, FutureBase< V, E > &... fs) noexcept
Definition await_on.hpp:11
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25