A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Sedeniono/tiny-optional/issues/1 below:

Default sentinals for more types? · Issue #1 · Sedeniono/tiny-optional · GitHub

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4