Generators, Coroutines and Other Brain Unrolling Sweetness
summary
Hands-on tour of C++20 coroutines showing generators that are lazy, composable and practical: builds an OpenCV spiral pixel generator and an RGB HSV color generator, zips them with a simple zip view and renders frames; an iota generator yields 42–50 when copied for nine elements. Uses Microsoft experimental std::generator and Lewis Baker’s recursive_generator (cppcoro) for recursive tree traversal. Highlights real failures too: dangling-reference bugs from temporaries, lack of a standard std::generator, and varying compiler heap-elision behavior.
AI-written summary · about
chapters (10)
- 0:00Intro
- 0:39FUNCTIONS A.K.A. SUB-ROUTINES
- 4:55USER DEFINED ITERATORS
- 6:39AWKWARD COUPLING
- 9:11DISTRIBUTED LOGIC
- 11:08LOGIC PUZZLE
- 14:57THE SIMPLEST CODE
- 16:18INFINITE RANGES
- 25:14DANGLING REFERENCES
- 29:41RESOURCES
related talks
56mGenerators, Coroutines and Other Brain Unrolling Sweetness
38mWhat's New In C++23
01h 35mNo Compiler Required - Hand-Rolling C++20 Coroutines in C++17
57mC++ Coroutines: Under the covers
48m“Coroutines: what can't they do?”
54mExploring Source Generators
47mA Journey into Ranges, Views, Pipelines, and Currying
01h 01mMoving to C++20 for Fun, Beauty... and Results!
