[Issue 3744] __traits getMember error in checking of second argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 2 14:40:20 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3744



--- Comment #8 from iorlas <denis.tomilin at gmail.com> 2010-02-02 14:40:11 PST ---
Maybe not a pure, but works(also, thx to eldar, qtd-developer):

template Alias(T...){ //small hack, cuz directly alias dont want to work
    alias T Alias;
}
alias Alias!(__traits(allMembers, abc)) ABCMEMBS; //alias creates data as
compile-time var
void main(){
    foreach(m;ABCMEMBS){ //now we can use it in compile-time
        writeln(m, ": ", typeid(typeof(__traits(getMember, abc, m)))); //all
ok, cuz it's in compile-time
    }
}

class abc{
    void foo(){
    }
    int a,b,c;
}

We have this output:
foo: void()
a: int
b: int
c: int

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list