Summary: Coroutines and Lazy Generators

A summary of what we discussed in the “Coroutines and Lazy Generators” chapter.

In this chapter, you have seen how to use C++ coroutines for building generators using the keywords co_yield and co_return. To better understand how C++ stackless coroutines differ from stackful coroutines, we compared the two and also looked at the customization points that C++ coroutines offer. This gave you a deep understanding of how flexible C++ coroutines are, as well as how they can be used to achieve efficiency. Stackless coroutines are closely related to state machines.

Get hands-on with 1400+ tech skills courses.