0

Is there a way to determine the underlying type / size of the underlying integer of an enum (in this case uint64)?

enum ErrorMask : uint64_t
{
    ET_NONE = 0,
    ET_ENGINE = (1u << 0),
    ET_OIL = = (1u << 1),
    ...
};

In this particular example I would like to do some bitwise operations and need to convert the enum value to an integer type. I can do checks on the size of the enum value and derive the required int type from that, but I would like to know whether there is a better way.

Ben
  • 1,519
  • 23
  • 39

0 Answers0