Move data from other to this buffer.
| 848 | |
| 849 | // Move data from other to this buffer. |
| 850 | FMT_CONSTEXPR20 void move(basic_memory_buffer& other) { |
| 851 | T* data = other.data(); |
| 852 | size_t size = other.size(), capacity = other.capacity(); |
| 853 | if (!move_alloc(other)) return; |
| 854 | if (data == other.store_) { |
| 855 | this->set(store_, capacity); |
| 856 | detail::copy<T>(other.store_, other.store_ + size, store_); |
| 857 | } else { |
| 858 | this->set(data, capacity); |
| 859 | // Set pointer to the inline array so that delete is not called |
| 860 | // when deallocating. |
| 861 | other.set(other.store_, 0); |
| 862 | other.clear(); |
| 863 | } |
| 864 | this->resize(size); |
| 865 | } |
| 866 | |
| 867 | public: |
| 868 | /// Constructs a `basic_memory_buffer` object moving the content of the other |