stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
ready_future.hpp File Reference

Factory functions for already-resolved futures. More...

#include <stlab/config.hpp>
#include <exception>
#include <type_traits>
#include <utility>
#include <stlab/concurrency/future.hpp>

Go to the source code of this file.

Functions

template<typename T, typename E>
auto stlab::make_ready_future (T &&x, E executor) -> future< std::decay_t< T > >
 Creates a future already completed with x (executor runs attached continuations).
template<typename E>
auto stlab::make_ready_future (E executor) -> future< void >
 Creates a future<void> already completed (executor runs attached continuations).
template<typename T, typename E>
auto stlab::make_exceptional_future (const std::exception_ptr &error, E executor) -> future< T >
 Creates a future already failed with error (executor runs attached continuations).

Detailed Description

Factory functions for already-resolved futures.

make_ready_future completes a package immediately with a value (or void). make_exceptional_future completes with an error. The executor argument schedules any attached continuation.