[Issue 15420] New: topN(Range, Range) does not respect its less predicate
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Dec 7 22:53:05 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15420
Issue ID: 15420
Summary: topN(Range, Range) does not respect its less predicate
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: lt.infiltrator at gmail.com
=============
import std.algorithm;
import std.stdio;
void main() {
int[] a = [ 5, 7, 2, 6, 7 ];
int[] b = [ 2, 1, 5, 6, 7, 3, 0 ];
topN!"a > b"(a, b);
sort!"a > b"(a);
assert(a == [ 7, 7, 7, 6, 6 ]);
}
=============
The above code fails on the assertion because topN has ignored the predicate
given to it.
--
More information about the Digitalmars-d-bugs
mailing list