Thursday 15 September 2011

c++ - Why var.constant is not allowed for an enum class? -



c++ - Why var.constant is not allowed for an enum class? -

suppose have enum class:

enum class e { constant };

to refer enumerator in e, can write e::constant, while next illegal:

e e; e.constant;

but consider this:

struct s { enum {constant}; };

both s::constant , s.constant legal, wouldn't more consistent allow e.constant enum class? inability intentional?

c++ c++11 enum-class

No comments:

Post a Comment