C++ Feature Coroutines, Beginner Friendly
summary
Covers the concrete mechanics: new keywords co_await, co_yield, co_return map to promise_type hooks and a wrapper return type; every coroutine creates a coroutine frame on the heap (a dynamic allocation unless avoided); shows a chat example with listen/answer, implements no STL generator fallback (generator + iterator for range‑for), an interleave of two vectors, and a scheduler that stores handles in a std::list using coroutine_handle<void> to round‑robin tasks. Also demonstrates a byte‑stream parser using co_await per byte, details exception propagation and restrictions (no constexpr/constructor/destructor/main coroutines).
AI-written summary · about
chapters (10)
- 0:00Introduction and setup
- 3:54Functions vs coroutines
- 16:57First coroutine example
- 34:34Interleaving vectors
- 46:15Adding iterators
- 46:36Cooperative multitasking
- 55:12Parsing data streams
- 1:07:45Handling exceptions
- 1:13:03Limitations and restrictions
- 1:15:10Q&A and closing
related talks
01h 06mC++ Coroutines from scratch
01h 01mUnderstanding C++ Coroutines by Example, Part 1
01h 36mUnderstanding C++ Coroutines by Example, Part 2: Generators
01h 26mC++ Coroutines - Don’t Try This at Home
48m“Coroutines: what can't they do?”
58m“Introduction to C++ Coroutines"
01h 30mC++ Coroutines and Structured Concurrency in Practice
52mCoroutines: C++ vs Rust
