On Saturday, 8 June 2013 at 13:57:13 UTC, Q wrote:
Hi there, I want to iterate over all the public members of a class.
It is a known problem. The workaround is to use is(typeof()): void main() { foreach (mem; __traits(allMembers, Foo)) { static if (is(typeof( __traits(getMember, Foo.init, mem) ))) { enum prot = __traits(getProtection, __traits(getMember, Foo.init, mem)); static if (prot == "public") { pragma(msg, mem); } } } }