Nick Sabalausky wrote: > "Lutger" <lutger.blijdest...@gmail.com> wrote in message > news:i5jmlc$13l...@digitalmars.com... >> Nick Sabalausky wrote: >> >>> "Lutger" <lutger.blijdest...@gmail.com> wrote in message >>> news:i5jiap$rv...@digitalmars.com... >>>> dsimcha wrote: >>>>>It can still be useful if you also change the loop body a >>>>> little, for example using multiple accumulators to increase instruction >>>>> level >>>>> parallelism, >>>>> but this is hard to write generically. I can't think of a way to write >>>>> such a >>>>> mixin such that it would be both generic and useful. >>>> >>>> Probably not for performance, but as a utility for metaprogramming I >>>> find >>>> it >>>> sometimes convenient. >>> >>> Isn't performance the whole point of loop unrolling? What other use could >>> there be? >> >> I should have called it 'static foreach' >> > > Ok, but I guess I still don't see how that relates to a mixin for loop > unrolling...? You seemed to be implying that you'd find a mixin for loop > unrolling useful for something other than performace. Do you just mean using > it like a "static foreach" back *before* "static foreach" was added?
Wait what, we have static foreach? I thought that didn't work out. I want this to work or something like it, is it possible? enum test = [1,2, 3]; foreach(i; 0..test.length) { pragma(msg, to!string(test[i]) ); }