Well, front() returns a reference. std::optional can't hold references. The closest you get is a plain pointer, with a null pointer for an empty container.
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.
Yeah, for some reason `std::optional<T&>` is cursed and can't get through standardization. People can't decide what should happen on assignment.
I 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