diff --git a/src/prevector.h b/src/prevector.h index d3e4b8fd0d..bcab1ff00c 100644 --- a/src/prevector.h +++ b/src/prevector.h @@ -264,8 +264,10 @@ public: fill(item_ptr(0), other.begin(), other.end()); } - prevector(prevector&& other) noexcept { - swap(other); + prevector(prevector&& other) noexcept + : _union(std::move(other._union)), _size(other._size) + { + other._size = 0; } prevector& operator=(const prevector& other) { @@ -277,7 +279,12 @@ public: } prevector& operator=(prevector&& other) noexcept { - swap(other); + if (!is_direct()) { + free(_union.indirect_contents.indirect); + } + _union = std::move(other._union); + _size = other._size; + other._size = 0; return *this; }