std.algorithm each documentation terse
jmh530 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jul 20 09:15:49 PDT 2015
On Monday, 20 July 2015 at 15:12:28 UTC, Marc Schütz wrote:
> On Monday, 20 July 2015 at 15:08:16 UTC, Nicholas Wilson wrote:
>> But the lambda takes a ref parameter...
>
> Yes, but it never writes to it:
>
> x.each!((ref a) => a + 1);
>
> Instead, this should work:
>
> x.each!((ref a) => a = a + 1);
>
> ... as a short-hand for:
>
> x.each!((ref a) { a = a + 1; });
This works! Thanks.
More information about the Digitalmars-d-learn
mailing list