OrderedIndex.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.

  1. size_t removeKey(Keys keys)
  2. size_t removeKey(Stuff stuff)
    mixin template OrderedIndex(size_t N, bool allowDuplicates, alias KeyFromValue, alias Compare, ThisContainer)
    size_t
    removeKey
    (
    Stuff
    )
    (
    Stuff stuff
    )
    if (
    isInputRange!Stuff &&
    isImplicitlyConvertible!(ElementType!Stuff, KeyType)
    &&
    !isDynamicArray!Stuff
    )
    out (r) { version (RBDoChecks) _Check(); }
  3. template implicitlyConverts(Key)

Return Value

Type: size_t

The number of elements removed.

Complexity: O(n keys d(n));
O(n keys log(n)) for this index

Examples

1 // ya, this needs updating
2 auto rbt = redBlackTree!true(0, 1, 1, 1, 4, 5, 7);
3 rbt.removeKey(1, 4, 7);
4 assert(std.algorithm.equal(rbt[], [0, 1, 1, 5]));
5 rbt.removeKey(1, 1, 0);
6 assert(std.algorithm.equal(rbt[], [5]));

Meta