3 ms·
Yeah, that's the whole point of std::optional. Pointers (including smart ones) have the possibility of being empty/pointing-to-nothing built in. std::optional a
by omnicognate 4y ago
Yeah, that's the whole point of std::optional. Pointers (including smart ones) have the possibility of being empty/pointing-to-nothing built in. std::optional adds it to value types.
To avoid tons of unnecessary copies use move semantics, which std::optional of course supports.