From 4d226ab5b546dad7ca394428af851e32b52a344d Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 6 Nov 2016 15:15:03 +0100 Subject: [PATCH] Enable swapping between SparseMatrix and SparseVector --- Eigen/src/SparseCore/SparseVector.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index 00ee6ec89..7a3d88c38 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -290,6 +290,14 @@ class SparseVector m_data.swap(other.m_data); } + template + inline void swap(SparseMatrix& other) + { + eigen_assert(other.outerSize()==1); + std::swap(m_size, other.m_innerSize); + m_data.swap(other.m_data); + } + inline SparseVector& operator=(const SparseVector& other) { if (other.isRValue())