--- Comment #8 from 2011-05-15 09:10:38 PDT ---
(In reply to comment #7)
> Hm, I don't get why we should start from scratch instead of reusing reduce.
> auto sum(R)(R range)
> if(is(typeof(ElementType!(R).init + ElementType!(R).init)))
> {
>     return reduce!"a + b"(0, range);
> }

I suggest to avoid using reduce here to allow a more efficient implementation
of sum() (keeping two summing values in parallel), see Comment #2.

Note1: I have shown two versions of sum() here, one accepts a starting value

Note2: I think your code doesn't work with the little unittest (main) I have
added, even if you comment out this line sum(a1,0).

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to