Looking at the enum
documentation, there was one thing that I noticed:
enum-key - one of
enum
,enum class
(since C++11), orenum struct
(since C++11)
enum
and enum class
, sure, but what is a enum struct
?
The docs seem to say that enum class
and enum struct
are exactly the same:
[...] scoped enumeration (declared with the enum-key
enum class
orenum struct
)
enum struct
|class
name{ enumerator = constexpr , enumerator = constexpr , ... }
- [...]
Are they really exactly the same? Or are there any differences that I missed? What is the point (if they are the same) to have 2 different syntax for the same thing?
enum class
and enum struct
are the same (emphasis mine).
7.2 Enumeration declarations
...
2 .... The enum-keysenum class
andenum struct
are semantically equivalent; an enumeration type declared with one of these is a scoped enumeration, and its enumerators are scoped enumerators.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments