April 2022
Intermediate to advanced
1012 pages
38h 1m
English
Objectives
In this chapter, you’ll:
Understand what coroutines are and how they’re used.
Use keyword co_yield to suspend a generator coroutine and return a result.
Use the co_await operator to suspend a coroutine while it waits for a result to become available.
Use a co_return statement to terminate a coroutine and return its result, or simply control, to its caller.
Use the open-source generator library to simplify creating a generator coroutine with co_yield.
Use the open-source concurrencpp library to simplify creating coroutines with co_await and co_return.
Become aware of coroutine capabilities being contemplated for future C++ versions.
Outline