It requires allocation if the coroutine outlives the scope that created it.
Otherwise compiler are free to implement heap allocation elision (which is done in Clang).
Now compared to Rust, assuming you have a series of coroutines to process a deferred event, Rust will allocate once for the whole series while C++ would allocate once per coroutine to store them in the reactor/proactor.
Otherwise compiler are free to implement heap allocation elision (which is done in Clang).
Now compared to Rust, assuming you have a series of coroutines to process a deferred event, Rust will allocate once for the whole series while C++ would allocate once per coroutine to store them in the reactor/proactor.