Freigeben über


unordered_set::erase

Removes an element or a range of elements in a unordered_set from specified positions or removes elements that match a specified key.

iterator erase(
   const_iterator Where
);
iterator erase(
   const_iterator First,
   const_iterator Last
);
size_type erase(
   const key_type& Key
);

Parameters

  • Where
    Position of the element to be removed.

  • First
    Position of the first element to be removed.

  • Last
    Position just beyond the last element to be removed.

  • Key
    The key value of the elements to be removed.

Return Value

For the first two member functions, a bidirectional iterator that designates the first element remaining beyond any elements removed, or an element that is the end of the unordered_set if no such element exists.

For the third member function, returns the number of elements that have been removed from the unordered_set.

Remarks

For a code example, see set::erase.

Requirements

Header: <unordered_set>

Namespace: std

See Also

Reference

<unordered_set>

unordered_set Class

unordered_set::clear

Standard Template Library