dpp::moveable_promise
awaitable.h
typename T
std::unique_ptr< basic_promise< T > > std::unique_ptr<basic_promise<T> > dpp::moveable_promise< T >::shared_state shared_state dpp::moveable_promise::shared_state = std::make_unique<basic_promise<T>>()

Shared state, wrapped in a unique_ptr to allow move without disturbing an awaitable's promise pointer.

bool Notify Notify true
typename... Args Args
void void dpp::moveable_promise< T >::emplace_value (Args &&... args) emplace_value dpp::moveable_promise::emplace_value Args &&... args (std::constructible_from<T, Args...>)

Construct the result in place by forwarding the arguments, and by default resume any awaiter.

Notify

Whether to resume any awaiter or not.

dpp::logic_exception

if the promise is not empty.

awaitable< T > awaitable< T > dpp::moveable_promise< T >::get_awaitable () get_awaitable dpp::moveable_promise::get_awaitable

Get an awaitable object for this promise.

dpp::logic_exception

if get_awaitable has already been called on this object.

awaitable<T> An object that can be co_await-ed to retrieve the value of this promise.

void void dpp::moveable_promise< T >::notify_awaiter () notify_awaiter dpp::moveable_promise::notify_awaiter

Notify a currently awaiting coroutine that the result is ready.

This may resume the coroutine on the current thread.

?

Any exception thrown by the coroutine if resumed will propagate

bool Notify Notify true
void void dpp::moveable_promise< T >::set_exception (std::exception_ptr ptr) set_exception dpp::moveable_promise::set_exception std::exception_ptr ptr
bool Notify Notify true
void void dpp::moveable_promise< T >::set_value () set_value dpp::moveable_promise::set_value (std::is_void_v<T>)

Construct a void result, and resume any awaiter.

Notify

Whether to resume any awaiter or not.

dpp::logic_exception

if the promise is not empty.

bool Notify Notify true
typename U T
void void dpp::moveable_promise< T >::set_value (U &&v) set_value dpp::moveable_promise::set_value U && v (std::convertible_to<U&&, T>)

Construct the result by forwarding reference, and resume any awaiter.

Notify

Whether to resume any awaiter or not.

dpp::logic_exception

if the promise is not empty.

Generic promise class, represents the owning potion of an asynchronous value.

This class is roughly equivalent to std::promise, with the crucial distinction that the promise IS the shared state. As such, the promise needs to be kept alive for the entire time a value can be retrieved.

The difference between basic_promise and this object is that this one is moveable as it wraps an underlying basic_promise in a std::unique_ptr.

awaitable

- dpp::moveable_promise
  emplace_value
- dpp::moveable_promise
  get_awaitable
- dpp::moveable_promise
  notify_awaiter
- dpp::moveable_promise
  set_exception
- dpp::moveable_promise
  set_value
- dpp::moveable_promise
  set_value
- dpp::moveable_promise
  shared_state