A day with coroutines
Coroutines are an exciting addition to C++20. You can now write resumable functions in C++. Such functions allow you a different style of programming in some instances, like, for example, implementing a parser.
Coroutines allow you to write cooperative multitasking applications as opposed to preemptive multitasking, where you need support from the operating systems and need to think more about about locking your data across threads.
In this class, you will start at the beginning with coroutines. You start with learning what coroutines are by example. On that road, you will learn the various customization points that help you configure the coroutine you need.
Controlling the memory a coroutine requires is essential in some domains. As part of this class, you will learn different techniques to stay in control of your device's memory.
After taking this class, you write your own efficient coroutine, avoiding common traps on the road.
The course is hands-on. Theory is interspersed with demos and exercises.
- What are coroutines
- Why coroutines
- Functions vs. coroutines
- Coroutine examples
- Coroutine restrictions
- The various customization points
- Overloading operator new for your promise-type
- A custom allocator for a promise-type
- Signals for when to use coroutine
- Exceptions and coroutines
- Efficient coroutine data flows
- C++23 std::generator
- Traps for coroutines
Andreas Fertig, CEO of Unique Code GmbH, is an experienced trainer and consultant for C++ for standards 11 to 23.
Andreas is involved in the C++ standardization committee, in which the new standards are developed. At international conferences, he presents how code can be written better. He publishes specialist articles, e.g., for iX magazine, and has published several textbooks on C++.
With C++ Insights (https://cppinsights.io), Andreas has created an internationally recognized tool that enables users to look behind the scenes of C++ and thus understand constructs even better.
Before working as a trainer and consultant, he worked for Philips Medizin Systeme GmbH for ten years as a C++ software developer and architect focusing on embedded systems.
You can find Andreas online at andreasfertig.com.