Era Scarecrow:

But that problem goes away if you turn it into a small array right? (And pass the array to the foreach to cycle over) So throwing that idea out there you get...

foo[] array;

foreach(m; std.traits.EnumMembers!foo)
    array ~= m;

foreach(m; array) {
 //not compiler-time expansion like above
}

Often better (but every time builds an array on the heap):

foreach (m; [EnumMembers!Foo]) { // Not a static foreach
}

Bye,
bearophile

Reply via email to