For example, I'd like to declare a variable inside a static
foreach like in below code, just for better organization,
otherwise, I have to use the value directly instead of the
variable. If the value is used more than once, it might be
inviable.
enum allMembers = __traits(derivedMembers, C);
static foreach(enum string member; allMembers) {
enum attributes = __traits(getAttributes, __traits(getMember,
C, member));
static foreach(C c; attributes) {
writeln(c);
}
}
I got redefinition erros of "atributes" on this. Can I have this
only at compile time?