Let task foo()
be a coroutine. I want to support:
co_await foo()
What would be the best way to do it?
- Implement
task::promise_type::await_transform
that return an Awaiter. - Implement
Awaiter final_suspend()
intask::promise_type
, like Lewis Baker code here: https://godbolt.org/z/3qKqWEqYG - Implement a global
operator co_await(task&& t)
- Implement
operator co_await()
in task
Any thoughts, knowledge, or practice on the mater?