The second part of the support is provided by header
<outcome/experimental/coroutine_support.hpp> if you want Coroutine support for
Experimental Outcome). This adds into namespace
OUTCOME_V2_NAMESPACE::experimental::awaitables) these awaitable types suitable
for returning from a Coroutinised function:
eager<T, Executor = void>
An eagerly evaluated Coroutine: invoking
co_awaitupon a function returning one of these immediately begins the execution of the function now. If the function never suspends, the overhead is similar to calling an ordinary function.
lazy<T, Executor = void>
A lazily evaluated Coroutine (often named
task<T>in most C++ Coroutine literature): invoking
co_awaitupon a function returning one of these causes the function to be immediately suspended as soon as execution begins. Only resuming the execution of the coroutine proceeds execution.
generator<T, Executor = void>
A lazily evaluated generator of values: the coroutine is resumed to generate the next value, upon which it is suspended until the next iteration.
atomic_eager<T, Executor = void>
eager<T>does not employ thread synchronisation during resumption of dependent coroutines which is fine if you do not traverse kernel threads during a suspend-resume cycle. If you do however potentially traverse kernel threads during suspend-resume, you ought to use
atomic_eager<T>instead – this uses atomics to synchronise the setting and checking of state to ensure correctness.
atomic_lazy<T, Executor = void>