-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Love the concept of this library, but to me it would be more useful it would pretty much guarantee to have a sentinel for every T as opposed to use an extra bool fallback for some types. I'd rather it would error if a sentinel wasn't possible.
In particular, default to INT_MIN and similar for all signed integer types, and MAX_UINT and similar for all unsigned types. Obviously there's times when these values don't work but it will work for almost everything and means you can directly use optional<T> instead of needing a manual case for optional<int, INT_MIN> or whatever. -1 is used too often as an actual valid value.
Also don't see why the sentinel for raw pointers isn't simply nullptr, the idea of having an optional value of an optional pointer. Makes these values also a bit more understandable in a debugger etc.