Date: Sun, 25 Sep 2022 15:15:33 +0200
Hey,
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?
Thanks,
Gergely Nagy
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?
Thanks,
Gergely Nagy
Received on 2022-09-25 13:15:45