~/talk

And Then() Some(T) Functional Adventures With C++23 std::optional and std::expected

Talkat CppNorth 2023 · 2023-07-17..07-19· [c-and-cpp, functional-programming]
slides:none on file

Argues that C++23’s std::optional plus std::expected and continuation helpers let code become functional by lifting functions and composing pipelines rather than unwrapping at each step. Shows concrete patterns: implements fmap for optional and vector, composes parsing and clamping via and_then continuations, and models a multi-step widget construction pipeline that returns optional values. Notes nested-option pitfalls and recommends std::expected to carry error context. Uses C++23, compiler stdlib support (gcc/clang/msvc) and working example code from slides.

AI-written summary · about

  1. 0:00Introduction to functional thinking
  2. 3:17Functional programming basics
  3. 11:25Lifting and higher-order functions
  4. 16:48Boxes and optional values
  5. 28:59Type constructors and composition
  6. 35:24Monads and chaining operations
  7. 42:55Expected for error handling
  8. 48:16C++23 standard support
  9. 52:10Retrofitting functional style
  10. 55:28Ranges and functional style
  11. 56:11Conclusion and readability
~/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.