C++11 extensions to enums – enum classes versus original “plain” enums (scoped and strongly-typed versus unscoped).

Underlying type is int:

enum struct|class Color { red, green, blue };
...
Color::red
Color::green

Possible definitions:

Warning w1 = Warning::red;
enum Warning w2 = Warning::green;
enum class Warning w3 = Warning::blue; // no

Stack Overflow explanation here.

See source for ios_base.h here.

  • c_enums.txt
  • Last modified: 2018/02/04 12:15
  • by rpjday