mp-coro main
Coroutine support tools
External resources

Main documentation

C++ Standard

Symmetric transfer of control

Halo: coroutine Heap Allocation eLision Optimization: the joint response

‍We DO NOT need to inline the body of the coroutine or the algorithm accumulate, unless the iterator type retains a pointer or reference to the generator<int> object.

Note that authors of coroutine types should be aware of this point: at least one blogger has described an implementation of generator<T>::iterator that holds a generator<T>*. However, every implementation of generator<T> we can find in the wild holds a coroutine_handle<Promise> instead, which avoids the problem, and allows heap allocation elision without inlining accumulate.