import std.range;
import std.stdio;
alias NumberPrinter = void delegate();
NumberPrinter[int] printers;
void main()
{
foreach (i; iota(5))
{
printers[i] = () { write(i); };
}
foreach (i; iota(5))
{
printers[i]();
}
}
This prints 4 4 4 4 4.
How to make it so that it prints 0 1 2 3 4? Is it possible
without changing the delegate definition to void delegate(int)?