~/talk

Understanding C++ Coroutines by Example, Part 2: Generators

Talkat C++ on Sea 2022 · 2022-07-05..07-07· [concurrency]
links:none on file
slides:none on file

Covers concrete C++20 generator implementation: shows a naive generator type with coroutine frame, initial_suspend/final_suspend, promise object and handle, and exact implementations of get_return_object, promise::yield_value, return_void and unhandled_exception. Demonstrates avoiding copies (lvalue/rvalue overloads and pointer storage), adds advance/get_value and an iterator-based begin/end API with exception semantics, explains recursive generators (yield whole generator) and an async pattern using co_await on next, and calls out the C++23 proposal issue std::generator limitation: begin only once.

AI-written summary · about

  1. 0:00Start
  2. 1:59Taxonomy of the Coroutines
  3. 5:39Best Practices
  4. 6:42Naive Generator
  5. 14:06Generator Type
  6. 17:08Get Return Object
  7. 17:53Initial Suspend and Final Spent
  8. 21:25Unhandled Exception
  9. 24:29Move Assignment Operator
  10. 48:43Can We Return Values of Different Types
  11. 51:41Parameters to Generators
  12. 58:02Value Initialized Checks
  13. 59:58Iterator Type
  14. 1:01:35Increment Operator
  15. 1:04:52Iterator
  16. 1:06:21Reference Operator
  17. 1:12:40Final Suspend
  18. 1:15:42Consequences of this Design
  19. 1:19:50Yielding Values from Nest Generators
  20. 1:21:23Recursive Generator
  21. 1:22:10Recursive Generators
  22. 1:31:45Async Synchronous Generators
~/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.