Let I
be some integral type. Now suppose I have a enum class my_enum_class : I
, with values which may not be consecutive. And now I get some I
value. How do I check whether it's a value enumerated in my_enum_class
?
An answer to a similar question (for the C language) makes the assumption that values are contiguous, and that one can add a "dummy" upper-bound value, and check the range between 0 and that value; that's not relevant in my case. Is there another way to do it?