How can I return a value, similar to null, with std::optional?
My function receives an int index as parameter to iterate through a list, if the index value is not valid, how this std::optional can be used to return a value similar to null?
How can I return a value, similar to null, with std::optional?
My function receives an int index as parameter to iterate through a list, if the index value is not valid, how this std::optional can be used to return a value similar to null?