Simpler:
import std.stdio: writeln;
import std.typetuple: TypeTuple;
template Iota(int stop) {
static if (stop <= 0)
alias TypeTuple!() Iota;
else
alias TypeTuple!(Iota!(stop-1), stop-1) Iota;
}
void foo(T, int N, int M)() {
writeln(typeid(T), " ", N, " ", M);
}
enum string[] types = ["int", "float", "short"];
alias TypeTuple!(int, float, short) types2;
enum string[] sizes = ["100", "200", "250"];
enum int[] sizes2 = [100, 200, 250];
void main() {
string run_t = "int";
string run_n = "200";
string run_m = "100";
foreach (t; Iota!(types.length))
foreach (n; Iota!(sizes.length))
foreach (m; Iota!(sizes.length))
if (run_t == types[t] && run_n == sizes[n] && run_m ==
sizes[m]) {
foo!(types2[t], sizes2[n], sizes2[m])();
goto END;
}
END: {}
}