
6 Mar
2009
6 Mar
'09
6:08 p.m.
Beman Dawes wrote:
The improved type safety of the C++0x scoped enum feature is attractive, so I'd like to start using it as it becomes available in compilers.
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a description. Note that the committee changed the name from strongly typed enums to scoped enums.
See the attached for a boost/detail header that provides macro wrappers that use scoped enums if available, otherwise fall back on C++03 namespaces and unscoped enums. It lets a library write:
Could this be rewritten to use structs instead of namespaces? This would allow to declare enums nested in classes.