View source code
Display the source code in std/container/rbtree.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.container.rbtree.RedBlackTree.removeKey

Removes elements from the container that are equal to the given values according to the less comparator. One element is removed for each value given which is in the container. If allowDuplicates is true, duplicates are removed only if duplicate values are given.

size_t removeKey(U...) (
  U elems
)
if (allSatisfy!(isImplicitlyConvertibleToElem, U));

size_t removeKey(U) (
  U[] elems
)
if (isImplicitlyConvertible!(U, Elem));

size_t removeKey(Stuff) (
  Stuff stuff
)
if (isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, Elem) && !isDynamicArray!Stuff);

Returns

The number of elements removed.

Complexity

Ο(m log(n)) (where m is the number of elements to remove)

Example

auto rbt = redBlackTree!true(0, 1, 1, 1, 4, 5, 7);
rbt.removeKey(1, 4, 7);
assert(equal(rbt[], [0, 1, 1, 5]));
rbt.removeKey(1, 1, 0);
assert(equal(rbt[], [5]));

Authors

Steven Schveighoffer, Andrei Alexandrescu

License

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at ).