std::basic_string<CharT,Traits,Allocator>::erase (3) - Linux Man Pages
basic_string& erase( size_type index = 0, size_type count = npos ); (1)
iterator erase( iterator position ); (until C++11)
iterator erase( const_iterator position ); (2) (since C++11)
iterator erase( iterator first, iterator last ); (3) (until C++11)
iterator erase( const_iterator first, const_iterator last ); (since C++11)
Removes specified characters from the string.
1) Removes min(count, size()- index) characters starting at index.
2) Removes the character at position.
3) Removes the characters in the range [first, last).
index - first character to remove
count - number of characters to remove
position - iterator to the character to remove
first, last - range of the characters to remove
2) iterator pointing to the character immediately following the character erased, or end() if no such character exists
3) iterator pointing to the character last pointed to before the erase, or end() if no such character exists
1) std::out_of_range if index > size().
In any case, if an exception is thrown for any reason, this function has no effect (strong exception guarantee).
// Run this code