[Issue 8155] Deprecate std.range.lockstep

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 28 17:18:30 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=8155



--- Comment #13 from bearophile_hugs at eml.cc 2013-06-28 17:18:28 PDT ---
(In reply to comment #12)

> In my real application, the value of x was determined by some rather complex
> calculations for which i was a parameter, so copy doesn't work either ... :-)

I see, for that I sometimes use a pattern like this:

import std.stdio, std.array, std.algorithm;
int calculations(TP)(TP ix) pure nothrow { return ix[1] ^^ 2 + ix[0]; }
void main() {
    auto arr = [10, 20, 30];
    arr.enumerate.map!calculations.copy(arr);
    arr.writeln;
}


If calculations() is pure and slow, then perhaps it's worth using a amap from
std.parallelism (but I don't know how well it interacts with the copy).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list