Traits: getting all *public* members of a class?
Adam D. Ruppe
destructionator at gmail.com
Sat Jun 8 07:05:17 PDT 2013
You could probably throw in a traits(compiles) right above.
foreach(...) {
// or maybe compiles, getProtection(getMember))
static if(__traits(compiles, __traits(getMember,Foo.init, mem)) {
enum prot = __traits(getProtection, __traits(getMember,
Foo.init, mem));
// and so on
}
}
I haven't actually tried this but generally static if(compiles)
is a way to work around unwanted error messages.
More information about the Digitalmars-d-learn
mailing list