...

/

std::optional

std::optional

std::optional is very convenient when the value of our object can be null or empty.

std::optional is quite comfortable for calculations such as database queries that may have a result.

๐Ÿ”‘ Donโ€™t use no-results
Before C++17 it was common practice to use a special value such as a null pointer, an empty string, or a unique integer to denote the absence of a result. These special values or no-results are ...