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
string::erase (1 of 3 overloads)

Erase characters from the string.

Synopsis
string&
erase(
    std::size_t pos = 0,
    std::size_t count = npos);
Description

Erases num characters from the string, starting at pos. num is determined as the smaller of count and size() - pos.

Exception Safety

Strong guarantee.

Remarks

All references, pointers, or iterators referring to contained elements are invalidated. Any past-the-end iterators are also invalidated.

Return Value

*this

Parameters

Name

Description

pos

The index to erase at. The default argument for this parameter is 0.

count

The number of characters to erase. The default argument for this parameter is npos.

Exceptions

Type

Thrown On

std::out_of_range

pos > size()


PrevUpHomeNext