[Issue 8342] New: Truly sorted output for topNCopy(zip())?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 3 13:18:04 PDT 2012
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 at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-07-03 13:18:02 PDT ---
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: -------
More information about the Digitalmars-d-bugs
mailing list