▲ | fluoridation 4 days ago | |
Nothing, but I don't think anyone uses std::optional<T *>. However, if you need to specify an optional integer, std::optional is much clearer than encoding the null value as a negative or other such hacks. Another use of std::optional is to delay construction of an object without an extra dynamic allocation. That's way more convenient than using placement new. |