[Glacier] Add the ability to remove a character from a StringBuilder.

This commit is contained in:
Drew Galbraith 2023-11-26 13:39:18 -08:00
parent 134185117d
commit c8e5441c7f
3 changed files with 33 additions and 0 deletions

View file

@ -45,6 +45,8 @@ class Vector {
template <typename... Args>
void EmplaceBack(Args&&... args);
T&& PopBack();
private:
T* data_;
uint64_t size_;
@ -119,6 +121,12 @@ void Vector<T>::EmplaceBack(Args&&... args) {
data_[size_++] = T(args...);
}
template <typename T>
T&& Vector<T>::PopBack() {
size_--;
return glcr::Move(data_[size_]);
}
template <typename T>
void Vector<T>::Expand() {
uint64_t new_capacity = capacity_ == 0 ? 1 : capacity_ * 2;