I'm writing some gui code, and am currently trying to make something equivalent to this:
int delegate()[] funcs;
funcs.length = 3;
foreach(i, ref f; funcs)
{
f = int() { return i; }
}
foreach(f; funcs)
{
writeln(f());
}
Prints:
3
3
3
I want it to print
0
1
2
Is there anyway to get this behaviour using delegate literals initialized with
a runtime loop?
