1 module nxt.static_iota; 2 3 /** Static Iota. 4 TODO Add to Phobos. 5 */ 6 template iota(size_t from, size_t to) 7 if (from <= to) 8 { 9 alias iota = siotaImpl!(to-1, from); 10 } 11 private template siotaImpl(size_t to, size_t now) 12 { 13 import std.meta: AliasSeq; 14 static if (now >= to) { alias siotaImpl = AliasSeq!(now); } 15 else { alias siotaImpl = AliasSeq!(now, siotaImpl!(to, now+1)); } 16 }