Functional Exception-less Error Handling with C++23’s Optional and Expected -- Sy Brand
This post is an updated version of an article from five years ago, now that everything Sy talked about is in the standard and implemented in Visual Studio.
Functional Exception-less Error Handling with C++23’s Optional and Expected
by Sy Brand
From the article:
In software things can go wrong. Sometimes we might expect them to go wrong. Sometimes it’s a surprise. In most cases we want to build in some way of handling these misfortunes. Let’s call them disappointments.
std::optionalwas added in C++17 to provide a new standard way of expressing disappointments and more, and it has been extended in C++23 with a new interface inspired by functional programming.


The Broker Pattern structures distributed software systems that interact with remote service invocations. It is responsible for coordinating the communication, its results, and exceptions.
In this article, I cover Default constructuctible lambdas.
The layers pattern splits a task into horizontal layers. Each layer has a specific responsibility and provides a service to a higher layer.