Summary
Before enum class (C++11), wrapping an unscoped enum in a struct (or namespace) was the standard way to keep enumerators from leaking into the enclosing scope, using the idiom:
struct Foo { enum Value { A, B, C }; }; // Foo::A — pre-C++11 scoped enum
This is currently handled automatically as a legacy special case. It would be clearer and more principled to be explicit about wrapping nested entities, which would also cover other cases the special struct-enum code currently cannot reach e.g. a struct with an enum plus other members, an enum nested in a class, etc.
See also: #113
Summary
Before
enum class(C++11), wrapping an unscopedenumin astruct(ornamespace) was the standard way to keep enumerators from leaking into the enclosing scope, using the idiom:This is currently handled automatically as a legacy special case. It would be clearer and more principled to be explicit about wrapping nested entities, which would also cover other cases the special struct-enum code currently cannot reach e.g. a
structwith anenumplus other members, anenumnested in aclass, etc.See also: #113