Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| c_enums [2018/02/04 09:52] – created rpjday | c_enums [2018/02/04 12:15] (current) – [Basics] rpjday | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Overview ===== | ===== Overview ===== | ||
| - | C++11 extensions to enums. | + | C++11 extensions to enums -- enum classes versus original " |
| + | |||
| + | ===== Basics ===== | ||
| + | |||
| + | Underlying type is '' | ||
| + | |||
| + | < | ||
| + | enum struct|class Color { red, green, blue }; | ||
| + | ... | ||
| + | Color:: | ||
| + | Color:: | ||
| + | </ | ||
| + | |||
| + | Possible definitions: | ||
| + | |||
| + | < | ||
| + | Warning w1 = Warning:: | ||
| + | enum Warning w2 = Warning:: | ||
| + | enum class Warning w3 = Warning:: | ||
| + | </ | ||
| + | |||
| + | ===== Treating scoped enums like ints ===== | ||
| + | |||
| + | Stack Overflow explanation [[https:// | ||
| + | |||
| + | See source for '' | ||