enum scope
Michel Fortin
michel.fortin at michelf.com
Thu Jan 26 03:57:14 PST 2012
On 2012-01-26 11:51:10 +0000, "Trass3r" <un at known.com> said:
>> You can use anonymous enums. The members will then live in the global
>> scope. You can then use just one alias to an int, uint or what's
>> appropriate.
>
> Yeah but you loose type safety.
Or if you absolutely need both type safety and the values to live in
the outer scope, you can do this:
enum Something
{
SomethingPointy,
SomethingSmooth,
}
alias Something.SomethingPointy SomethingPointy;
alias Something.SomethingSmooth SomethingSmooth;
But that's rather extreme verbosity at the definition.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list