bsl::unordered_set::erase

Erase the element equivalent to key, if present.

Synopsis

Declared in <bslstl_unorderedset.h>

unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
erase(key_type const& key);

Description

Remove from this set the value_type object that is equivalent to the specified key, if such an entry exists, and return 1; otherwise, if there is no value_type object that is equivalent to key, return 0 with no other effect. This method invalidates only iterators and references to the removed element and previously saved values of the end() iterator, and preserves the relative order of the elements not removed.

Return Value

1 if erased, otherwise 0

Parameters

NameDescription
keykey value to look up