Greetings I thought I would be able to use allMembers/getMembers traits to access the attributes of all the members of a class. But that fails me if some members of the class are private.
Consider the code pasted below -- I get en error: B.d(5): Error: class A.Foo member bar is not accessible And so it seems it is essential that tupleof works with getAttributes, since tupleof does not care for access protection. I have filed a bug on Budzilla. http://d.puremagic.com/issues/show_bug.cgi?id=9178 Regards - Puneet module A; enum Boo; class Foo { private @Boo int bar; } module B; void main() { import A; Foo foo = new Foo; static if(__traits(getProtection, __traits(getMember, foo, "bar")) // <-- can not access foo.bar == "public") { // Check for attribute Boo and proceed } }