Add std::string::erase

This commit is contained in:
Baptiste Wicht 2018-04-06 09:20:13 +02:00
parent aa120b3de5
commit aea178bbde

View File

@ -305,6 +305,20 @@ public:
(*this)[size()] = '\0';
}
/*!
* \brief Erase the character at the given position
*/
void erase(size_t position) {
if(position >= size()){
return;
}
std::copy(begin() + position + 1, end(), begin() + position);
set_size(size() - 1);
(*this)[size()] = '\0';
}
/*!
* \brief Ensures a capacity of at least new_capacity
*/