skinny delegates

kinke noone at nowhere.com
Sat Aug 4 13:07:54 UTC 2018


On Saturday, 4 August 2018 at 12:21:18 UTC, Steven Schveighoffer 
wrote:
> You don't even need to make a copy to show problems, the 
> context isn't passed by reference:
>
> const r1 = dg();
> const r2 = dg();
>
> assert(r1 == 43 && r2 == 44); // would fail with optimization.
>
> -Steve

This depends on the implementation; assuming that captured `x` 
represents the `*cast(int*) context` lvalue, this example would 
work.


More information about the Digitalmars-d mailing list