Search⌘ K
AI Features

Introduction

Learn about C++20 coroutines by exploring their theory, usage, and performance. Understand stackful versus stackless coroutines, how C++ implements these features, and how to use co_await, co_yield, and co_return. Discover how to create abstractions for lazy generators and write clearer, composable coroutine-based components.

We'll cover the following...

Computing has become a world of waiting, and we need support in our programming languages to express wait. The general idea is to suspend (temporarily pause) the current flow and hand execution over to some other flow whenever it reaches a point where we know that we might have to wait for something. This something that we need to wait for could be a network request, a click from a user, a database operation, or even a memory access that is taking too long for us to block.

Instead, we say in our code that we will wait, continue some other flow, and then come back when ready. Coroutines allow us to do ...