I am reading an enum
value from a binary file and would like to check if the value is really part of the enum
values. How can I do it?
Maybe use enum like this:
enum MyEnum
{
A,
B,
C
};
and to check
if (v2 >= A && v2 <= C)
If you don't specify values for enum constants, the values start at zero and increase by one with each move down the list. For example, given
enum MyEnumType { ALPHA, BETA, GAMMA };
ALPHA has a value of 0, BETA has a value of 1, and GAMMA has a value of 2.