(Don't) use coroutines for this
summary
Shows concrete patterns and failure modes: using std::generator for lazy flows, building a heap‑free recursive VM by forcing initial_suspend and never_ready, and when that breaks (heap allocation, hidden allocations, or UB from relying on return value optimization). Implements short, testable examples: coroutines as state machines for variant-based states, early‑return propagation like std::expected, simple parser combinators, and a tiny executor that actually runs suspended frames.
AI-written summary · about
chapters (14)
- 0:00Punk rock C++ intro
- 1:10Rebelling against C++ best practices
- 2:34Misra recursion with coroutines
- 8:43Manual stackless coroutines
- 14:07Coroutines by example
- 17:19Coroutines for error handling
- 23:24Undefined behavior with coroutines
- 27:39Early returns and dynamic casts
- 28:41State machines with coroutines
- 34:25State machine demo
- 35:07Coroutines as control flow
- 36:35Parsers with coroutines
- 38:21Coroutines summary
- 39:48Closing and Q&A
related talks
01h 04mDeciphering Coroutines - a visual approach
01h 02mC++ Coroutines from scratch
54mawait 2.0: Stackless Resumable Functions
55mBehavioral Modeling in HW/SW Co-design Using C++ Coroutines
01h 00mDesign Idioms from an Alternate Universe
01h 03mFrom Problem to Coroutine: Reducing I/O Latency
26mInfinite Possibilities
01h 04mA Pattern Language for Expressing Concurrency in Cpp
