int i = 1;
auto dg = (){ writefln("%s", i); };
i = 2;
dg(); // prints '2'Is there a way to make the delegate "capture by value" so that the call prints '1'?
Note that in C++, both variants are available using
[&]() { printf("%d", i); }
and
[=]() { printf("%d", i); }
respectively.
