umbrello  2.39.2
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
cxx11-strongly-typed-enumerations.h
Go to the documentation of this file.
1 // https://en.wikipedia.org/wiki/C%2B%2B11#Strongly_typed_enumerations
2 
3 // #1
4 enum class Enumeration {
5  Val1,
6  Val2,
7  Val3 = 100,
8  Val4 // = 101
9 };
10 
11 // #2
12 enum class Enum2 : unsigned int {Val1, Val2};
13 
14 // #3
15 enum Enum3 : unsigned long {Val1 = 1, Val2};
16 
17 // #4
18 //enum Enum1; // Illegal in C++03 and C++11; the underlying type cannot be determined.
19 enum Enum4 : unsigned int; // Legal in C++11, the underlying type is explicitly specified.
20 enum class Enum5; // Legal in C++11, the underlying type is int.
21 
22 enum class Enum6 : unsigned int; // Legal in C++11.
23 //enum Enum2 : unsigned short; // Illegal in C++11, because Enum2 was previously declared with a different underlying type.
int int y int
Definition: cxx11-lambda-functions-and-expressions.h:4
Enum3
Definition: cxx11-strongly-typed-enumerations.h:15
@ Val1
Definition: cxx11-strongly-typed-enumerations.h:15
@ Val2
Definition: cxx11-strongly-typed-enumerations.h:15
Enum2
Definition: cxx11-strongly-typed-enumerations.h:12
Enumeration
Definition: cxx11-strongly-typed-enumerations.h:4