| 218 | }; |
| 219 | template <typename T, bool is_pod> |
| 220 | void SmallVectorTemplateBase<T, is_pod>::grow(size_t min_sz) { |
| 221 | size_t cur_capacity = this->capacity(); |
| 222 | size_t cur_sz = this->size(); |
| 223 | size_t new_capacity = (cur_capacity + 2) * 2; |
| 224 | if (new_capacity < min_sz) { |
| 225 | new_capacity = min_sz; |
| 226 | } |
| 227 | T* elms = static_cast<T*>(malloc(new_capacity * sizeof(T))); |
| 228 | |
| 229 | this->uninitialized_move(this->begin(), this->end(), elms); |
| 230 | |
| 231 | this->destroy_range(this->begin(), this->end()); |
| 232 | |
| 233 | if (!this->is_small()) { |
| 234 | free(this->begin()); |
| 235 | } |
| 236 | |
| 237 | this->m_begin_ptr = elms; |
| 238 | this->set_end(elms + cur_sz); |
| 239 | this->m_capacity_ptr = this->begin() + new_capacity; |
| 240 | } |
| 241 | |
| 242 | template <typename T> |
| 243 | class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> { |
no test coverage detected