fix bug in move constructor

This commit is contained in:
2020-07-31 00:00:26 +03:00
parent 79e17b48b8
commit 1d5c979607
6 changed files with 30 additions and 20 deletions

View File

@@ -32,7 +32,6 @@ template <typename T>
class PIDeque {
public:
inline PIDeque(): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
//piCout << "PIDeque";
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
}
inline PIDeque(const PIDeque<T> & other): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
@@ -49,11 +48,10 @@ public:
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
resize(pid_size, f);
}
inline PIDeque(PIDeque<T> && other): pid_data(other.pid_data), pid_size(other.pid_size), pid_rsize(other.pid_size), pid_start(other.pid_start) {
inline PIDeque(PIDeque<T> && other): pid_data(other.pid_data), pid_size(other.pid_size), pid_rsize(other.pid_rsize), pid_start(other.pid_start) {
other._reset();
}
inline virtual ~PIDeque() {
//piCout << "~PIDeque";
PIINTROSPECTION_CONTAINER_DELETE(T)
PIINTROSPECTION_CONTAINER_FREE(T, (pid_rsize))
deleteT(pid_data + pid_start, pid_size);
@@ -70,8 +68,7 @@ public:
}
inline PIDeque<T> & operator =(PIDeque<T> && other) {
PIDeque<T> moved(std::move(other));
swap(moved);
swap(other);
return *this;
}

View File

@@ -86,8 +86,7 @@ public:
}
PIMap<Key, T> & operator =(PIMap<Key, T> && other) {
PIMap<Key, T> moved(std::move(other));
swap(moved);
swap(other);
return *this;
}

View File

@@ -48,7 +48,7 @@ public:
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
resize(piv_size, f);
}
inline PIVector(PIVector<T> && other): piv_data(other.piv_data), piv_size(other.piv_size), piv_rsize(other.piv_size) {
inline PIVector(PIVector<T> && other): piv_data(other.piv_data), piv_size(other.piv_size), piv_rsize(other.piv_rsize) {
other._reset();
}
inline virtual ~PIVector() {
@@ -69,8 +69,7 @@ public:
}
inline PIVector<T> & operator =(PIVector<T> && other) {
PIVector<T> moved(std::move(other));
swap(moved);
swap(other);
return *this;
}