C++ on Sea 2022
Understanding C++ coroutines by example,
part 1 and part 2: generators
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.
Part 1
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.
Video: https://www.youtube.com/
Description on the conference site:
https://cpponsea.uk/
Slides:
Part 2: generators
This time we will concentrate on the generators part of the coroutines.
We’ll get up to speed with how coroutines work under the hood, and then learn about the co_yield
keyword, and how simple generators and asynchronous generators conceptually work.
Video: https://www.youtube.com/
Description on the conference site:
https://cpponsea.uk/
Slides: