YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
split.hpp
Go to the documentation of this file.
1#pragma once
2
6
7namespace yaclib {
8
9template <typename V, typename E>
11 static_assert(std::is_copy_constructible_v<Result<V, E>>, "Cannot split this Result<V, E>");
12 auto [f, p] = MakeSharedContract<V, E>();
13 Connect(std::move(future), std::move(p));
14 return std::move(f);
15}
16
17template <typename V, typename E>
22
23} // namespace yaclib
Provides a mechanism to access the result of async operations.
Definition future.hpp:20
detail::SharedCorePtr< V, E > & GetCore() noexcept
#define YACLIB_ASSERT(cond)
Definition log.hpp:85
SharedFuture< V, E > Split(FutureBase< V, E > &&future)
Definition split.hpp:10
void Connect(FutureBase< V, E > &&f, Promise< V, E > &&p)
Definition connect.hpp:11
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25