How to remove the key from the `redBlackTree` with comparator" a <= b "?

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 7 11:42:54 PDT 2015


I understand that `removeKey` works only with the comparator "a < 
b":
http://dlang.org/phobos/std_container_rbtree.html#.RedBlackTree.removeKey
>Removes elements from the container that are equal to the given 
>values according to the less comparator.

How do I remove the key from the `redBlackTree` with comparator 
"a <= b" ?

auto rbt = redBlackTree!("a <= b", int)(1, 2, 3, 4, 5, 6, 7);
rbt.removeKey(6);

foreach (key; rbt)
     write(key);
// prints 1234567


More information about the Digitalmars-d-learn mailing list