Move data from other to this buffer.
| 323 | private: |
| 324 | // Move data from other to this buffer. |
| 325 | void move(MemoryBuffer &other) { |
| 326 | Allocator &this_alloc = *this, &other_alloc = other; |
| 327 | this_alloc = std::move(other_alloc); |
| 328 | this->size_ = other.size_; |
| 329 | this->capacity_ = other.capacity_; |
| 330 | if (other.ptr_ == other.data_) { |
| 331 | this->ptr_ = data_; |
| 332 | std::copy(other.data_, |
| 333 | other.data_ + this->size_, make_ptr(data_, this->capacity_)); |
| 334 | } else { |
| 335 | this->ptr_ = other.ptr_; |
| 336 | // Set pointer to the inline array so that delete is not called |
| 337 | // when freeing. |
| 338 | other.ptr_ = other.data_; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | public: |
| 343 | MemoryBuffer(MemoryBuffer &&other) { |