Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
object::erase (2 of 2 overloads)

Erase an element.

Synopsis
std::size_t
erase(
    string_view key);
Description

Remove the element which matches key, if it exists. References and iterators to the erased element are invalidated. Other iterators and references are not invalidated.

Complexity

Constant on average, worst case linear in size().

Exception Safety

No-throw guarantee.

Return Value

The number of elements removed, which will be either 0 or 1.

Parameters

Name

Description

key

The key to match.


PrevUpHomeNext