MCPcopy Create free account
hub / github.com/fmtlib/fmt / move

Method move

include/fmt/format.h:850–865  ·  view source on GitHub ↗

Move data from other to this buffer.

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

resizeMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected