What is the difference between enum struct and enum class?
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.
enum class
, sure, but what is aenum struct
?
Same as enum class
.
Are they really exactly the same?
Yes. The documentation is correct.
Or are there any differences that I missed?
No. There are no differences.
What is the point (if they are the same) to have 2 different syntax for the same thing?
I haven't found any written rationalization for the decision. There isn't any in the standard nor the proposal. One might guess that it is some sort of counterpart to class
vs struct
class-keys. This is an opposite decision than was made when template<class T>
syntax was specified, where struct
is not allowed.