fix(vector): bugs of move constructor/assignment in supporting files.
This commit is contained in:
@ -41,7 +41,7 @@ public:
|
||||
Matrix(const Matrix<_Td> &mat)
|
||||
: n_rows(mat.n_rows), n_cols(mat.n_cols), data(mat.data) {}
|
||||
Matrix(Matrix<_Td> &&mat) noexcept
|
||||
: n_rows(mat.n_rows), n_cols(mat.n_cols), data(mat.data) {}
|
||||
: n_rows(mat.n_rows), n_cols(mat.n_cols), data(std::move(mat.data)) {}
|
||||
Matrix<_Td> & operator=(const Matrix<_Td> &rhs)
|
||||
{
|
||||
this->n_rows = rhs.n_rows;
|
||||
@ -53,7 +53,7 @@ public:
|
||||
{
|
||||
this->n_rows = rhs.n_rows;
|
||||
this->n_cols = rhs.n_cols;
|
||||
this->data = rhs.data;
|
||||
this->data = std::move(rhs.data);
|
||||
return *this;
|
||||
}
|
||||
inline const size_t & RowSize() const
|
||||
|
@ -15,11 +15,11 @@ public:
|
||||
pair(pair &&other) = default;
|
||||
pair(const T1 &x, const T2 &y) : first(x), second(y) {}
|
||||
template<class U1, class U2>
|
||||
pair(U1 &&x, U2 &&y) : first(x), second(y) {}
|
||||
pair(U1 &&x, U2 &&y) : first(std::move(x)), second(std::move(y)) {}
|
||||
template<class U1, class U2>
|
||||
pair(const pair<U1, U2> &other) : first(other.first), second(other.second) {}
|
||||
template<class U1, class U2>
|
||||
pair(pair<U1, U2> &&other) : first(other.first), second(other.second) {}
|
||||
pair(pair<U1, U2> &&other) : first(std::move(other.first)), second(std::move(other.second)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user