Is it possible to parallelise the iteration over an AliasSec? Ordinary parallel foreach does not work. I have tried submitting tasks to taskPool in an ordinary foreach, but I can't because i cannot be read at compile time.

int one(int) {return 1;}
int two(int) {return 2;}
int three(int) {return 3;}
int four(int) {return 4;}
int five(int) {return 5;}
int six(int) {return 6;}
int seven(int) {return 7;}
int eight(int) {return 8;}

int[8] values;

template eval_all(funcs...)
        void eval_all(int val)
                import std.parallelism;
                //foreach (i, f; parallel(funcs))       // Tries to evaluate 
                foreach (i, f; funcs)   // How do I parallelise this?
                        values[i] = f(val);

void main()
        eval_all!(one, two, three, four, five, six, seven, eight)(42);
        foreach(i, val; values)
                assert(val == i + 1);


Reply via email to