This would be a really basic and quite useful feature. min() and max() for enums would make it possible to create generic enum sets using std::bitset, and this can be a great optimization. A lot of people use std::unordered_set for enums, which is a waste.

Additionally there could be an is_sparse() member that would tell if there is any gap, or even some gap statistics, so one could statically use std::unordered_set for very sparse enums and something more lightweight (like bitset) for dense ones.

What do you think?

   Gergely Nagy