On Sunday, 7 June 2015 at 19:04:08 UTC, Dennis Ritchie wrote:
OK. But I want to return a `upperBound` segment with the included `key`. It does not suit me:

auto rbt = redBlackTree!("a < b", int)(1, 2, 3, 4, 5);
writeln(rbt.upperBound(3)); // prints [4, 5]

I want it to be so:

auto rbt = redBlackTree!("a <= b", int)(1, 2, 3, 4, 5);
writeln(rbt.upperBound(3)); // prints [3, 4, 5]

How do I do with the comparator "a < b" ?

Use equalRange to get the elements that equal 3, too:
writeln(std.range.chain(rbt.equalRange(3), rbt.upperBound(3)));

Reply via email to