Yes, I have found:

=========================
#!/usr/bin/rdmd
import std.stdio;

void main()
{
    void delegate() functions[];

    foreach (i; 0..10)
    {
        auto get_print(int i)
        {
            void print()
            {
                writefln("%s", i);
            }

            return &print;
        }

        functions ~= get_print(i);
    }

    foreach (i; 0..10)
    {
        functions[i]();
    }
}
=========================

Thank you!

Reply via email to