Accessing The Stored Value
Explore how to retrieve stored values from std::optional in C++17. Understand the use of operator*, value(), and value_or() methods, learn to check for value presence safely, and improve code reliability when managing optional data.
We'll cover the following...
We'll cover the following...
Probably the most important operation for optional (apart from creation) is the way you can fetch the contained value. You have already seen it working with operator*.
However, ...