http://d.puremagic.com/issues/show_bug.cgi?id=4725
--- Comment #8 from bearophile_h...@eml.cc 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 too. 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------