User Tools

Site Tools


c_enums

This is an old revision of the document!


Overview

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

Basics

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
c_enums.1517739550.txt.gz · Last modified: 2018/02/04 10:19 by rpjday