Skip to content

Default sentinals for more types? #1

@aardappel

Description

@aardappel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions