Templates problem
Russel Winder via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Sep 7 01:19:39 PDT 2016
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.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20160907/13283a15/attachment-0001.sig>
More information about the Digitalmars-d-learn
mailing list