Understanding C++ coroutines by example, part 1

Pavel Novikov

60 minute session
16:30-17:30, Wednesday, 13th July 2022

Note: this is part 1 of the two talks. They cover separate aspects of coroutines and are designed to be mostly independent, so you can watch just one of the talks (though you would benefit from watching both, if you want), and watch them in any order.

Coroutines are a powerful tool added to C++20. There are no out-of-the-box facilities in the standard library that are user friendly and immediately usable, although there are plenty of libraries out there already providing such primitives.

Also there are now best practices regarding usage of coroutines in C++ that emerged while people were learning them, and that programmers should know about.

There is a chance standard primitives will be added to C++23 so all the machinery will be "hidden" from the user, though there's still value in learning how it works under the hood. So we’ll be doing just that.

We’ll figure out how to use coroutines from the ground up by example of how to work with asynchronous tasks. You'll learn about co_await and co_return keywords, "magical" transformations of coroutine code done by the compiler, and some basic challenges and best practices.


Pavel Novikov

Got an engineering degree in missilery from BMSTU (Moscow).

Loves C++ and knows how to cook it.

Likes metaprogramming, multithreading and asynchronous programming, coroutine adoption enthusiast.