alias to fully qualified enum in scope where enum is expected

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 6 08:22:36 PDT 2014


On Wednesday, 6 August 2014 at 07:23:32 UTC, Rikki Cattermole 
wrote:
> The magic of with statements!
>
> enum A {
>  	a1,
> 	a2
> }
>
> void func(A a){}
> void main(){
> 	func(A.a1);
> 	with(A) {
> 		func(a1);
> 	}
> }

And if you want to be *really* concise:

with (A) fun(a1);


More information about the Digitalmars-d-learn mailing list