On Saturday, 27 January 2018 at 17:54:53 UTC, thedeemon wrote:
On Saturday, 27 January 2018 at 11:19:37 UTC, Arun
Chandrasekaran wrote:
Simplified test case that still errors:
You got really close here. Here's a working version:
enum Operation {
a,
b
}
import std.traits, std.conv, std.stdio;
void main(string[] args) {
auto op = Operation.a;
foreach (_; 0 .. args.length) {
final switch (op) {
foreach(e; EnumMembers!Operation) {
case e:
mixin(e.to!string ~ "();");
break;
}
}
}
}
void a() { writeln("A!"); }
void b() { writeln("B!"); }
Thanks, that did the trick.
How to use break inside a static foreach? Changing the above
foreach each to static gives the following error:
Error: must use labeled break within static foreach