~/talk

Safe and Readable Code - Monadic Operations in C++23

Talkat C++ on Sea 2025 · 2025-06-23..06-25· [c-and-cpp, functional-programming]
links:none on file
slides:none on file

Shows how C++20/23 monadic operations make code clearer by using std::views::transform and std::views::join, returning errors with std::optional or std::expected, and wiring continuations with the cute library; demonstrates a custom pointer-monad and a writer-monad for lock-free tracing. Benchmarks on a pipeline that expands to ~250k items show views are 2–13× faster than naive container pipelines while a views+container combo can be ~38× slower, worst case ~6 ns/item. Highlights real pitfalls like dangling reference from lazy views and confusing auto return types.

AI-written summary · about

  1. 0:00Introduction
  2. 1:14Traditional error handling problems
  3. 3:19Talk goals and focus
  4. 4:41Functors introduction
  5. 8:36Functors as transformations
  6. 9:38Functor rules
  7. 11:25Functional pipelines with views
  8. 13:53Key view characteristics
  9. 15:40Views pitfalls and best practices
  10. 17:27Callables in monadic ops
  11. 21:19Monads introduction
  12. 23:26Monadic pipelines for errors
  13. 25:34Pure functions benefits
  14. 33:05Error handling with optional/expected
  15. 36:42Chaining optional ops
  16. 40:35Advanced expected handling
  17. 44:31Optional first-success pipeline
  18. 47:21Debugging monadic compiler errors
  19. 50:36Custom monadic wrappers
  20. 56:38Combining monads
  21. 1:01:18Performance benchmarks
  22. 1:06:39Key takeaways and practical recommendations
~/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.