MCPcopy Create free account
hub / github.com/ablab/spades / move

Method move

ext/include/cppformat/format.h:325–340  ·  view source on GitHub ↗

Move data from other to this buffer.

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 2

make_ptrFunction · 0.85
copyFunction · 0.50

Tested by

no test coverage detected