Introduction to C++ Coroutines

Phil Nash

1-day-workshop
intermediate
advanced
10:00-19:00, Tuesday, 27th June 2023

This was originally going to be presented by Nathan Baggs, who has fallen ill.

Instead Phil Nash will present materials prepared by Mateusz Pusz.



The full details of Mateusz' materials can be found, here: https://train-it.eu/trainings/cpp/78-cpp-20.

But in summary we will cover:

  • What Coroutines are. Their current and future state in C++
  • How to write your own Coroutines in C++ 20, today
  • All the pieces and how they fit together - in depth

    • Generators
    • Async Tasks
    • Making existing types into Coroutine objects and Awaitables
  • Performance:

    • Symmetric transfer
    • Doing more at compile time
    • Using the right value categories
    • Avoiding unnecessary heap allocations

We will use many worked examples all in Compiler Explorer - so a laptop with wifi access is required.

This is a challenging course and requires good familiarity with modern C++, including templates and value categories. We will also make use of concepts.

Coroutines
C++20
Book now

Phil Nash

Phil is the original author of the C++ test framework, Catch2, and composable command line parser, Clara. As Developer Advocate at Sonar he's involved with SonarQube, SonarLint and SonarCloud, particularly in the context of C++. He's also a member of the ISO C++ standards committee, organiser of C++ London and C++ on Sea, as well as co-host and producer of CppCast. More generally he's an advocate for good testing practices, TDD and using the type system and functional techniques to reduce complexity and increase correctness. He's previously worked in Finance and Mobile offers training and coaching in C++ and TDD.