bsl::unordered_map::erase

Erase the element with the specified key, if present.

Synopsis

Declared in <bslstl_unorderedmap.h>

size_type
erase(key_type const& key);

Description

Remove from this unordered map the value_type object having the specified key, if it exists, and return 1; otherwise (there is no object with a key equivalent to key in this unordered map) 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 to look up