Generic promise class, represents the owning potion of an asynchronous value.
More...
|
template<bool Notify = true, typename... Args>
requires (std::constructible_from<T, Args...>) |
void | emplace_value (Args &&... args) |
| Construct the result in place by forwarding the arguments, and by default resume any awaiter. More...
|
|
template<bool Notify = true, typename U = T>
requires (std::convertible_to<U&&, T>) |
void | set_value (U &&v) |
| Construct the result by forwarding reference, and resume any awaiter. More...
|
|
template<bool Notify = true>
requires (std::is_void_v<T>) |
void | set_value () |
| Construct a void result, and resume any awaiter. More...
|
|
template<bool Notify = true> |
void | set_exception (std::exception_ptr ptr) |
|
void | notify_awaiter () |
| Notify a currently awaiting coroutine that the result is ready. More...
|
|
awaitable< T > | get_awaitable () |
| Get an awaitable object for this promise. More...
|
|
template<typename T>
class dpp::moveable_promise< T >
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.
- See also
- awaitable