Asik
Asik

Reputation: 22133

What does "enum class" mean in Visual C++ 2012?

There are two conflicting definitions of enum class in Visual C++ 2012:

Does the meaning of enum class change when you enable or disable the /clr switch?

Upvotes: 3

Views: 1532

Answers (1)

James McNellis
James McNellis

Reputation: 355049

A managed enumeration must have an access specifier (either public or private). A C++11 scoped enumeration must not have an access specifier. For example,

enum class E { e0 };

public enum class F { f0 };
private enum class G { g0 };

E is valid in C++, C++/CLI, and C++/CX, and it is an ordinary C++ scoped enumeration.

F and G are valid only in C++/CLI and C++/CX, and they name a managed enumeration (in C++/CLI) or a Windows Runtime enumeration (in C++/CX).

Upvotes: 7

Related Questions