📖 Book · cpp20 · advanced

C++20 coroutines: a generator from scratch

co_yield, promise_type and coroutine_handle — build a lazy generator you can range-for over.

C++20 coroutines explained by building one: stackless cooperative suspension, the promise_type protocol, a complete runnable lazy Generator<T> driving Fibonacci, the heap frame + coroutine_handle model, and where coroutines beat threads.

4 chapters▶ runnable code✦ in-depth animation

What this book covers

  1. 01What a coroutine actually is
  2. 02A lazy generator — run it
  3. 03Suspend, resume & the frame
  4. 04Where coroutines shine

Read it in full — runnable C++ + step-through animations

Every chapter of C++20 coroutines: a generator from scratch ships complete, editable code you compile and run in the browser, plus the same in-depth animations as the lessons.