mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-09 12:31:06 -04:00
Add std::string::erase
This commit is contained in:
parent
aa120b3de5
commit
aea178bbde
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user