Commit 65510518 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added missing move-assignment operator to SparseMatrix

parent d4e43445
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1044,13 +1044,21 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator >
       */

      /**
       * \brief Assignment of exactly the same matrix type.
       * \brief Copy-assignment of exactly the same matrix type.
       *
       * \param matrix is input matrix for the assignment.
       * \return reference to this matrix.
       */
      SparseMatrix& operator=( const SparseMatrix& matrix );

      /**
       * \brief Move-assignment of exactly the same matrix type.
       *
       * \param matrix is input matrix for the assignment.
       * \return reference to this matrix.
       */
      SparseMatrix& operator=( SparseMatrix&& matrix );

      /**
       * \brief Assignment of dense matrix
       *
+22 −0
Original line number Diff line number Diff line
@@ -831,6 +831,28 @@ operator=( const SparseMatrix& matrix )
   Matrix< Real, Device, Index >::operator=( matrix );
   this->columnIndexes = matrix.columnIndexes;
   this->segments = matrix.segments;
   this->indexAllocator = matrix.indexAllocator;
   this->view = this->getView();
   return *this;
}

// move assignment
template< typename Real,
          typename Device,
          typename Index,
          typename MatrixType,
          template< typename, typename, typename > class Segments,
          typename ComputeReal,
          typename RealAllocator,
          typename IndexAllocator >
SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >&
SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
operator=( SparseMatrix&& matrix )
{
   this->columnIndexes = std::move( matrix.columnIndexes );
   this->segments = std::move( matrix.segments );
   this->indexAllocator = std::move( matrix.indexAllocator );
   Matrix< Real, Device, Index >::operator=( std::move( matrix ) );
   this->view = this->getView();
   return *this;
}