Expect the Expected
summary
Proposal to standardize Expected<T> as a generic return type (work spearheaded by Jean‑Francois Bastian) encodes either a value or an error object, using an unexpected wrapper to tag error cases. It lets code choose local checks (if/result and dereference syntax) or centralized throwing (operator* triggers throw), transports rich error data across threads/APIs, and supports collections of results. Implementation details: careful noexcept/move/swap rules, tricky transactional swaps, and measurable compile/runtime tradeoffs versus classic exceptions; currently proposed for C++20.
AI-written summary · about
chapters (17)
- 0:00Intro
- 2:15Discussing Exceptions
- 6:03Discussing Error Handling
- 17:12Discussing Special Values
- 20:47Exceptions
- 23:15Expected vs Unexpected
- 25:44Exception Handling
- 29:20Exception Aftermath
- 34:25Optional
- 35:33Promising Future
- 36:04Defining Expected
- 45:41Implementation
- 52:42Value
- 53:29Swap
- 58:56Typical Years
- 59:10Unexpected
- 59:31centralized use








