64template <task_value_type T =
void,
typename Allocator =
void>
75 std::coroutine_handle<> continuation = std::noop_coroutine();
91 std::coroutine_handle<>
94 return this_coro.promise().continuation;
119 return std::coroutine_handle<promise_type>::from_promise(promise).done();
124 std::coroutine_handle<>
await_suspend(std::coroutine_handle<> h)
const noexcept {
127 return std::coroutine_handle<promise_type>::from_promise(promise);
133 return promise.
get();
146 operator co_await()
const &
noexcept requires std::move_constructible<T> {
151 awaiter_of<T &&> auto operator co_await()
const &&
noexcept requires std::move_constructible<T> {
154 struct rvalue_awaiter :
awaiter {
157 return std::move(this->promise).get();
160 return rvalue_awaiter({*promise_});
174template <awaitable A>
177 co_return co_await std::forward<A>(
awaitable);
Task that produces a value of type T: to get that value, simply await the task.
task(promise_type *promise)
Private constructor used in promise_type::get_return_object.
task(task &&)=default
Move constructor.
task< remove_rvalue_reference_t< await_result_t< A > > > make_task(A &&awaitable)
promise_ptr< promise_type > promise_
An owning pointer to the promise object in the coroutine frame.
task & operator=(task &&)=delete
Move assignment not allowed.
T value_type
The type of the value produced by this task.
std::unique_ptr< T, coro_deleter > promise_ptr
RAII wrapper that destroys promise object's associated coroutine.
Base class with deleted copy constructor and copy assignment operator.
promise_type & promise
Reference to the promise object of the task in question.
bool await_ready() const noexcept
Returns true if the task's coroutine is already done (suspended at its final suspension point).
decltype(auto) await_resume() const
Return the value of the task's promise.
std::coroutine_handle await_suspend(std::coroutine_handle<> h) const noexcept
Set the current coroutine as this task's continuation, and then resume this task's coroutine.
Awaiter returned by final_suspend.
std::coroutine_handle await_suspend(std::coroutine_handle< promise_type > this_coro) noexcept
Required promise type for coroutines returning a task.
task get_return_object() noexcept
Returns a task that references this promise.
static awaiter_of< void > auto final_suspend() noexcept
Resumes the continuation of this task when awaited.
static std::suspend_always initial_suspend() noexcept
Lazy: not started until awaited.
std::coroutine_handle continuation