3 ms·
Other languages allow to return `Option<&T>`. That's what I'm using these days. I suppose a raw ptr is what I would use on C++ to model that case though, yes.
by dureuill 4y ago
Other languages allow to return `Option<&T>`. That's what I'm using these days.
I suppose a raw ptr is what I would use on C++ to model that case though, yes.
- planede 4y agoYeah, for some reason `std::optional<T&>` is cursed and can't get through standardization. People can't decide what should happen on assignment.
- dureuill 4y agoI guess a raw pointer is good enough an approximation in that case, it is just annoying that suddenly you can no longer use an optional because your type is a reference