std.algorithm.map - function by reference

Justin Whear via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 24 15:07:15 PDT 2014


On Tue, 24 Jun 2014 21:46:15 +0000, kuba wrote:

> Hi there,
> I was wondering if std.algorithm.map can take functions with 
> parameters passed by reference? The main point here is to avoid 
> unnecessary copies by perhaps I'm using the wrong tool for the 
> job.

No, `map` is a _projection_ function and is not intended to perform 
modification in place.
There has been discussion of an `each` function which would act as a sink 
and which could potentially pass by reference.


More information about the Digitalmars-d-learn mailing list