Boost C++ Libraries Home Libraries People FAQ More

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

system_error

pos > size()


PrevUpHomeNext