9#ifndef STLAB_CONCURRENCY_READY_FUTURE_HPP
10#define STLAB_CONCURRENCY_READY_FUTURE_HPP
21#include <stlab/config.hpp>
32STLAB_VERSION_NAMESPACE_BEGIN()
43template <typename T, typename E>
46 std::move(
executor), [](
auto&& x) {
return std::forward<decltype(x)>(x); });
47 p.first(std::forward<T>(x));
48 return std::move(p.second);
62struct _make_exceptional_future {
64 auto operator()(
const std::exception_ptr& error, E executor)
const -> future<T> {
66 [](
auto&& a) {
return std::forward<decltype(a)>(a); });
67 p.first.set_exception(error);
68 return std::move(p.second);
73struct _make_exceptional_future<void> {
75 auto operator()(
const std::exception_ptr& error, E executor)
const -> future<void> {
77 p.first.set_exception(error);
78 return std::move(p.second);
85template <
typename T,
typename E>
87 return detail::_make_exceptional_future<T>{}(error, std::move(
executor));
94STLAB_VERSION_NAMESPACE_END()
One-shot asynchronous result: holds a value or exception produced by a promise or packaged_task.
Definition future.hpp:300
Futures, packaged tasks, channels, and coroutine integration.
auto package(E, F &&) -> std::pair< detail::packaged_task_from_signature_t< Sig >, detail::reduced_result_t< Sig > >
Creates a packaged task and its future for the callable f, run on executor.
Definition future.hpp:1269
auto make_exceptional_future(const std::exception_ptr &error, E executor) -> future< T >
Creates a future already failed with error (executor runs attached continuations).
Definition ready_future.hpp:86
auto make_ready_future(T &&x, E executor) -> future< std::decay_t< T > >
Creates a future already completed with x (executor runs attached continuations).
Definition ready_future.hpp:44
Definition reverse.hpp:28
Wraps an executor_t for use with operator&.
Definition executor_base.hpp:74