~/talk

Deciphering C++ Coroutines - A Diagrammatic Coroutine Cheat Sheet

Talkat CppCon 2022 · 2022-09-11..09-16· [rust]
slides:none on file

Step‑by‑step walkthrough of C++20 coroutine mechanics with copy‑paste skeletons: constructs a minimal coroutine and shows why the compiler requires a promise_type, how the return object is built, and how await_ready/await_suspend/await_resume control suspension. Demonstrates storing data in the promise, implementing generators (Fibonacci), toggling startup/shutdown with initial_suspend/final_suspend (suspend_always vs suspend_never), using coroutine_handle::resume/destroy, co_yield via promise::yield_value, and symmetric transfer by returning a handle from await_suspend.

AI-written summary · about

  1. 0:00Start
  2. 2:39Overview
  3. 4:11Basics
  4. 6:24Asynchronous Computation
  5. 9:01Suspended Computation
  6. 9:28Compute the Fibonacci Sequence
  7. 13:17Function Signature
  8. 14:59Fibonacci Generator
  9. 18:17Futures and Promises
  10. 20:42Compile Errors
  11. 21:56Return Void Function
  12. 22:20An Unhandled Exception
  13. 22:41Functions Initial Suspend and Final Suspend
  14. 25:03Awaitable
  15. 27:29Weight Suspend
  16. 28:56Weight Resume
  17. 30:07Resume
  18. 30:24Destroy
  19. 31:20Convert from a Core Routine Handle to the Promise Object
  20. 36:33Resume Execution
  21. 51:19Hand Control Back to another Co-Routine
  22. 54:26Learning the Syntax
  23. 1:00:33Final Suspend
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.