3 ms·
Hmm... Do you really need to wrap a pointer in std::optional?
by Koshkin 8y ago
Hmm... Do you really need to wrap a pointer in std::optional?
- int_19h 8y agoIt forces anyone trying to use it to contemplate the no-value case.
- kllrnohj 8y agoReplace the pointer with a value type and now you'd see why the optional is necessary. Similarly I'd probably substitute the optional with a variant that has the actual error code. Go nuts with whatever you want here.
- Koshkin 8y ago> Go nuts Let's make error code optional, too.