enum scope

Trass3r un at known.com
Thu Jan 26 04:10:04 PST 2012


> 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.

As I said in the first post, this is what I actually do.
Though I use a mixin like mixin(bringIntoCurrentScope!Something);

But inserting this everywhere is rather annoying. And since the 
whole module is guarded by an extern(C): anyway I figured the 
compiler could do it for me.


More information about the Digitalmars-d mailing list