mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Sparse move
This commit is contained in:
committed by
Antonio Sánchez
parent
c8d368bdaf
commit
7b5d32b7c9
@@ -788,8 +788,11 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
Base::operator=(other);
|
||||
}
|
||||
|
||||
inline SparseMatrix(SparseMatrix&& other)
|
||||
: Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) {
|
||||
/** Move constructor */
|
||||
inline SparseMatrix(SparseMatrix&& other) : SparseMatrix() { this->swap(other); }
|
||||
|
||||
template <typename OtherDerived>
|
||||
inline SparseMatrix(SparseCompressedBase<OtherDerived>&& other) : SparseMatrix() {
|
||||
*this = other.derived().markAsRValue();
|
||||
}
|
||||
|
||||
@@ -857,7 +860,10 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline SparseMatrix& operator=(SparseMatrix&& other) { return *this = other.derived().markAsRValue(); }
|
||||
inline SparseMatrix& operator=(SparseMatrix&& other) {
|
||||
this->swap(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
template <typename OtherDerived>
|
||||
@@ -872,6 +878,12 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
template <typename OtherDerived>
|
||||
EIGEN_DONT_INLINE SparseMatrix& operator=(const SparseMatrixBase<OtherDerived>& other);
|
||||
|
||||
template <typename OtherDerived>
|
||||
inline SparseMatrix& operator=(SparseCompressedBase<OtherDerived>&& other) {
|
||||
*this = other.derived().markAsRValue();
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef EIGEN_NO_IO
|
||||
friend std::ostream& operator<<(std::ostream& s, const SparseMatrix& m) {
|
||||
EIGEN_DBG_SPARSE(
|
||||
|
||||
@@ -304,6 +304,24 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_,
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline SparseVector(SparseVector&& other) : SparseVector() { this->swap(other); }
|
||||
|
||||
template <typename OtherDerived>
|
||||
inline SparseVector(SparseCompressedBase<OtherDerived>&& other) : SparseVector() {
|
||||
*this = other.derived().markAsRValue();
|
||||
}
|
||||
|
||||
inline SparseVector& operator=(SparseVector&& other) {
|
||||
this->swap(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename OtherDerived>
|
||||
inline SparseVector& operator=(SparseCompressedBase<OtherDerived>&& other) {
|
||||
*this = other.derived().markAsRValue();
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
template <typename Lhs, typename Rhs>
|
||||
inline SparseVector& operator=(const SparseSparseProduct<Lhs, Rhs>& product) {
|
||||
|
||||
Reference in New Issue
Block a user