| 154 | } |
| 155 | |
| 156 | void Resize(size_t newCapacity) { |
| 157 | const size_t size = GetSize(); // Backup the current size |
| 158 | stack_ = (char*)allocator_->Realloc(stack_, GetCapacity(), newCapacity); |
| 159 | stackTop_ = stack_ + size; |
| 160 | stackEnd_ = stack_ + newCapacity; |
| 161 | } |
| 162 | |
| 163 | void Destroy() { |
| 164 | Allocator::Free(stack_); |