Returning std::optional
Explore how to return std::optional from functions in C++17 to handle nullable values safely. Understand the use of std::nullopt for unavailable values, copy elision benefits, and pitfalls of returning optionals inside braces.
We'll cover the following...
We'll cover the following...
If you return an optional from a function, then it’s very convenient to return just std::nullopt or
the computed value.
In the above example you can see that the function returns std::string computed ...