std.algorithm each documentation terse

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 20 08:08:15 PDT 2015


On Monday, 20 July 2015 at 14:59:21 UTC, John Colvin wrote:
> On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
>> [...]
>
> Everything is exactly as I would expect. Lambdas with => are 
> just shorthand that skips the return expression and 
> std.algorithm.each just calls the lambda for each element in x, 
> it doesn't say anything about copying the result back in to x.
>
> x.map!(a => a * a).copy(x);

But the lambda takes a ref parameter...


More information about the Digitalmars-d-learn mailing list