When declaring an enum (class) I can specify the underlying type that the enum will use, e.g.
enum class MyEnum : baseType { FIRST, SECOND };
What can baseType be? The usual choice would be uint32_t or something similar but could it also be float? Or even my own class?
N4140 [dcl.enum]/2:[...] The type-specifier-seq of an enum-base shall name an integral type; any cv-qualification is ignored. [...]
So baseType can be any integral type, i.e. bool, char, char16_t, char32_t, wchar_t and the signed and unsigned integer types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With