User Tools

Site Tools


c_enums

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
c_enums [2018/02/04 09:52]
rpjday created
c_enums [2018/02/04 10:19]
rpjday [Overview]
Line 1: Line 1:
 ===== Overview ===== ===== Overview =====
  
-C++11 extensions to enums.+C++11 extensions to enums -- enum classes versus original "​plain"​ enums (//scoped and strongly-typed//​ versus //​unscoped//​). 
 + 
 +===== Basics ===== 
 + 
 +Underlying type is ''​int'':​ 
 + 
 +<​code>​ 
 +enum struct|class Color { red, green, blue }; 
 +... 
 +Color::​red 
 +Color::​green 
 +</​code>​ 
 + 
 +Possible definitions:​ 
 + 
 +<​code>​ 
 +Warning w1 = Warning::​red;​ 
 +enum Warning w2 = Warning::​green;​ 
 +enum class Warning w3 = Warning::​blue;​ // no 
 +</​code>​
c_enums.txt · Last modified: 2018/02/04 12:15 by rpjday