On Tue, 2016-09-06 at 14:50 +0000, Lodovico Giaretta via Digitalmars-d- learn wrote: > […] > From a quick look, it looks like `results` is a > `const(TickDuration[3])`, that is a fixed-length array. And > fixed-length arrays aren't ranges. If you explicitly slice them, > they become dynamic arrays, which are ranges. > > So the solution is to call `map` with `results[]` instead of > `results`.
So trying with results[] leads to: run_checks.d(21): Error: mutable method std.algorithm.iteration.MapResult!(function (TickDuration t) => to(t).total(), const(TickDuration)[]).MapResult.opIndex is not callable using a const object run_checks.d(21): Error: mutable method std.algorithm.iteration.MapResult!(function (TickDuration t) => to(t).total(), const(TickDuration)[]).MapResult.opIndex is not callable using a const object run_checks.d(21): Error: mutable method std.algorithm.iteration.MapResult!(function (TickDuration t) => to(t).total(), const(TickDuration)[]).MapResult.opIndex is not callable using a const object yes, the message is repeated three times, for unknown reason. Possibly because the compiler is fairly certain I am not going to believe it. So the upshot of this is that I can't work with const data, which is dreadful in these days of single assignment being the way of doing things. So what is the way of constructing a range from a const array? If it involves copying then D is doomed. And yes I am under stress as I am trying to pitch D to Python people next week. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part