Compile time iota

zeljkog via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 21 10:14:09 PST 2015


Maybe something like this can be added to Fobos:

template Iota(int start, int stop, int step = 1){
     template tuple(T...){
         alias tuple = T;
     }
     static if(start < stop)
         alias Iota = tuple!(start, Iota!(start + step, stop, step));
     else
         alias Iota = tuple!();
}


More information about the Digitalmars-d mailing list