On 6/08/2014 6:11 p.m., Timothee Cour via Digitalmars-d-learn wrote:
Is there a simple way to to do this?

enum A{
a1,
a2
}

void fun(A a){...}
void test(){
  fun(A.a1); //works
  fun(a1); //I'd like a1 to work, but just where an A is expected to
avoid polluting namespace.
}

The magic of with statements!

enum A {
        a1,
        a2
}

void func(A a){}
void main(){
        func(A.a1);
        with(A) {
                func(a1);
        }
}

Reply via email to