www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8342] New: Truly sorted output for topNCopy(zip())?

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

           Summary: Truly sorted output for topNCopy(zip())?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



Related to Issue 8341

I think in this case topNCopy should be able to generate a truly sorted output
(instead of a heap):


import std.stdio, std.algorithm, std.range, std.typecons;
void main() {
    auto a = [10, 20, 30];
    auto b = ["c", "b", "a"];
    Tuple!(int, string)[4] sorted_ab;
    writeln(a, " ", b);
    topNCopy!q{a > b}(zip(a, b), sorted_ab[], true); // error
    topNCopy!q{a > b}(zip(a, b), sorted_ab[]); // OK
    writeln(a, " ", b);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 03 2012