string::erase
Erase characters from the string.
Synopsis
string&
erase(
std::size_t pos = 0,
std::size_t count = string::npos); (1)
string::iterator
erase(
string::const_iterator pos); (2)
string::iterator
erase(
string::const_iterator first,
string::const_iterator last); (3)
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.
All references, pointers, or iterators referring to contained elements are invalidated. Any past-the-end iterators are also invalidated. |
Return Value
*this
Return Value
An iterator referring to character immediately following the erased character, or end()
if one does not exist.
Return Value
An iterator referring to the character last
previously referred to, or end()
if one does not exist.
Parameters
Name | Description |
---|---|
|
The index to erase at. The default argument for this parameter is |
|
The number of characters to erase. The default argument for this parameter is |
|
An iterator representing the first character to erase. |
|
An iterator one past the last character to erase. |
Exceptions
Type | Thrown On |
---|---|
|
|