parallelism

thedeemon dlang at thedeemon.com
Sat Jan 27 17:54:53 UTC 2018


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!"); }


More information about the Digitalmars-d-learn mailing list