Blog post on automem

ag0aep6g via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed May 3 04:56:01 PDT 2017


On 05/03/2017 01:05 PM, ANtlord wrote:
> As far as I know a delegate depends on GC.

Closures depend on the GC. Not all delegates involve closures.

For example, you don't need the GC to make a delegate of a method:

----
struct S
{
     int x = 0;
     void m() @nogc { x = 1; }
}

void main() @nogc
{
     S s;
     void delegate() @nogc dg = &s.m;
     dg();
     assert(s.x == 1);
}
----


More information about the Digitalmars-d-announce mailing list