What do you do when you have to return multiple values from a function? Do you return an instance of some data structure? Do you use output variables? Maybe you throw an exception to get rid of the error codes? It’s not an obvious choice. C++23 offers a standardized solution to deal with status codes and expected return values at the same time in a sophisticated manner with the help of the library. How we used to do it? Handling nominal return values and status codes is a problem we have had several solutions for, though none of them is perfect. Using output parameters Probably the most ancient and most used way of returning both a status code and a nominal result (i.e. an expected value) is via “out” variables. Let’s say you have a function that returns an error code - which is often an integer - and the nominal return value via an out variable. It could be the other way around, but more often it’s like this. Why and why not the other way around? I see two reasons for that: the error code is easier…