We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
C++20’s Coroutines for Beginners - Andreas Fertig - CppCon 2022
C++20 coroutines explained for beginners, covering co-routines, cooperative multitasking, and customization points, with real-world examples of parsing data streams, scheduling, and more.
- C++20 coroutines are a way to write asynchronous code that is easier to read and maintain than traditional callback-based code.
- Coroutines are essentially co-routines, allowing for cooperative multitasking.
-
The author uses a simple example of a coroutine that prints numbers, demonstrating how to use
co_yield
,co_wait
, andco_return
. -
The author also discusses other customization points such as
initial_suspend
,pending
, andfinal_suspend
. - Coroutines can be used for cooperative multitasking, replacing traditional threading models.
- The author demonstrates how to implement a simple scheduler that allows for coroutine scheduling.
- Coroutines can also be used for parsing data streams, making it easier to write readable and maintainable code.
- The author discusses how to implement a generator using coroutines, allowing for efficient and readable code.
- Coroutines can also be used for operating system-level programming, allowing for efficient and readable code.
- The author discusses how to use coroutines with lambda functions, allowing for more concise code.
- The author also discusses the use of coroutines with vectors, allowing for efficient and readable code.
- Coroutines can also be used for parsing data streams, making it easier to write readable and maintainable code.
- The author discusses how to implement a coroutine that can be suspended and resumed, allowing for cooperative multitasking.