Value closures (no GC allocation)

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Sun May 21 13:25:14 PDT 2017


On Sunday, 21 May 2017 at 20:09:14 UTC, Stanislav Blinov wrote:
> is a function that is generated by the template. It accesses 
> the frame of create(). Am I missing something?

It does access the frame, but only long enough to copy the values 
into the struct.... there's no reason for that to allocate....

And, indeed it doesn't if you pass the object directly to another 
function; only when you return it does the compiler complain 
(which I didn't try before posting, just passing it down the 
function chain like in the OP). That's annoying. The mixin will 
have to be moved up a level.

Blah. Well, let's go ahead and formally propose the C++ syntax, 
our library solutions are all fat.


More information about the Digitalmars-d mailing list