aboutsummaryrefslogtreecommitdiff
path: root/src/prevector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/prevector.h')
-rw-r--r--src/prevector.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/prevector.h b/src/prevector.h
index f36cfe4ff6..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<N, T, Size, Diff>&& other) {
- swap(other);
+ prevector(prevector<N, T, Size, Diff>&& other) noexcept
+ : _union(std::move(other._union)), _size(other._size)
+ {
+ other._size = 0;
}
prevector& operator=(const prevector<N, T, Size, Diff>& other) {
@@ -276,8 +278,13 @@ public:
return *this;
}
- prevector& operator=(prevector<N, T, Size, Diff>&& other) {
- swap(other);
+ prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
+ if (!is_direct()) {
+ free(_union.indirect_contents.indirect);
+ }
+ _union = std::move(other._union);
+ _size = other._size;
+ other._size = 0;
return *this;
}