4 ms·
The purpose is exactly to express possibly missing return values, which is exactly why it is called "optional", rather than "pointer_type_semantics<T>". I also
by svalorzen 8y ago
The purpose is exactly to express possibly missing return values, which is exactly why it is called "optional", rather than "pointer_type_semantics<T>".
I also don't see why you would ever use it in the way you're describing. Even if you had template code, either you manipulate objects/references, or pointers. And worst case, you usually try to handle references, rather than trying to risk UB.
- masklinn 8y ago> The purpose is exactly to express possibly missing return values Operative word: type-safe. std::optional is not that. > I also don't see why you would ever use it in the way you're describing. I'm literally just describing the semantics of std::optional.