C++20’s Coroutines for Beginners
summary
Starts from plain functions and shows C++20 coroutines actually working: implements a generator wrapper type with promise_type, an iterator for range‑based for, a chat-like wrapper that exchanges strings, and a cooperative scheduler using std::list plus awaitable that pushes/resumes handles. Explains customization points like suspend_always/suspend_never and uses co_await/co_yield/co_return; demos compile with clang and GCC and produce the expected interleaved and scheduler output.
AI-written summary · about
chapters (15)
- 0:00Start
- 1:42Overview Comparing Normal Functions To Cool Routines
- 6:04Cooperative Multitasking
- 8:01Interact with Core Routines
- 9:55Elements of a Core Routine in C Plus
- 10:06Wrapper Type
- 14:14Disclaimer
- 32:17While Loop
- 33:45Setup the Get Return Object
- 39:15Equal Operator
- 41:04Scheduling Multiple Tasks
- 44:36Function Schedule
- 46:48Scheduler
- 55:03Questions
- 59:56What Are the Requirements in Current Compile Implementation To Enable Heap Election
related talks
58mAn Introduction to C++ Coroutines
55mC++20 coroutines as an API principle
01h 03mHow C++20 changes the way we write code
01h 05mWhy use coroutines for asynchronous applications
01h 02mC++23: using std::generator in practice
01h 05mCoroutines: C++ vs Rust
47mC++ coroutines and Qt
57m[filtered] Asynchronous C++ Programming
