Closed lefticus closed 3 months ago
Why would you have a std::optional<std::unique_ptr<>>
? I mean, it would make sense if std::unique_ptr
could not be empty (Actually that would make more sense), but since std::unique_ptr
can be empty, using std::unique_ptr
over std::optional<std::unique_ptr<>>
is better.
It was just the first example I came up with. The point being, anything with a pointer-like interface containing anything with a pointer-like interface.
This is based on a real issue I had someone DM to me about their own code.
Coming in Ep 424
If you have a pointer like thing that contains a pointer like thing.
std::optional<std::unique_ptr<>>
for example