Make CScript (and prevector) c++11 movable.

Such moves are used when reallocating vectors that contain them,
for example.
This commit is contained in:
Pieter Wuille
2016-12-13 19:36:46 -08:00
parent e8cfe1ee2d
commit 2ddfcfd2d6
3 changed files with 29 additions and 2 deletions

View File

@@ -248,6 +248,10 @@ public:
}
}
prevector(prevector<N, T, Size, Diff>&& other) : _size(0) {
swap(other);
}
prevector& operator=(const prevector<N, T, Size, Diff>& other) {
if (&other == this) {
return *this;
@@ -263,6 +267,11 @@ public:
return *this;
}
prevector& operator=(prevector<N, T, Size, Diff>&& other) {
swap(other);
return *this;
}
size_type size() const {
return is_direct() ? _size : _size - N - 1;
}