Introduction to proposed std::expected
summary
Post‑Toronto std::expected T, E aims for WG21 adoption around C++20 and promises an optional‑like API plus monadic operators and an operator try proposal to reduce the boilerplate of nested ifs. Benchmarks show exception unwinds costing on the order of tens of thousands of CPU cycles versus predictable expected returns. A construct‑shim and two‑phase construction pattern appears for no‑throw object creation (used in the AFIO file‑handle example), and an outcome bridging implementation is already compiled to interoperate with Boost Outcome.
AI-written summary · about
chapters (4)
- 0:00Start
- 9:27Failure handling logic is as important or more important than success handling logic? • The cost of fully testing your code for exception safety isn't worth it to your organisation? Code peer review checks correctness of failure handling first?
- 25:36Use in functional programming
- 39:25Implementing object construction with Expected
related talks
01h 01mExpect the Expected
59mthe expected outcome
46mFive Issues with std::expected and How to Fix Them
56mThe Dawn of a new Error
59mTo err is human - error handling in C++26
01h 02mOption(al) is not a failure
01h 00mC++23: An Overview of Almost All New and Updated Features
02h 02mPeering forward: C++'s next decade
