[Issue 18634] New: RBTree does not work with delegate comparators
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 19 22:21:31 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18634
Issue ID: 18634
Summary: RBTree does not work with delegate comparators
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: trivial
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: viktor.ivanov at gmail.com
The RedBlackTree does not work with delegate comparators due to
RedBlackTree.opEquals() forcing a function when doing the equality comparison.
The following test shows the issue:
import std.algorithm.comparison : equal;
auto t = new RedBlackTree!(int, delegate (a, b) => a > b);
t.insert([1, 3, 5, 4, 2]);
assert(t[].equal([5, 4, 3, 2, 1]));
--
More information about the Digitalmars-d-bugs
mailing list