Is there however some way to generate that switch with cases for each enum member in a template, so that each case calls <some-passed-template-func>(Machine)() instantiated with the appropriate enum member? I know you could do it with string mixins, but that be a hassle to implement...

Eventually, I want my code to look like

    void func(Machine machine)() { ... }
    switchOnEachEnumMember!func(machine);

http://dpaste.dzfl.pl/ce8366a7

The foreach is unrolled at compile time.

Reply via email to