[Issue 4725] std.algorithm.sum()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 11 13:34:23 PDT 2010


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



--- Comment #1 from bearophile_hugs at eml.cc 2010-10-11 13:33:52 PDT ---
One test case for sum():


import std.algorithm: sum;
void main() {
    bool[] array = [true, false, true, true];
    assert(sum(array) == 3);
}



Currently this doesn't compile:
reduce!q{a + b}(array)

You need to add a 0 start:
reduce!q{a + b}(0, array)

-- 
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