Enable swapping between SparseMatrix and SparseVector

This commit is contained in:
Gael Guennebaud 2016-11-06 15:15:03 +01:00
parent ad086b03e4
commit 4d226ab5b5

View File

@ -290,6 +290,14 @@ class SparseVector
m_data.swap(other.m_data);
}
template<int OtherOptions>
inline void swap(SparseMatrix<Scalar,OtherOptions,StorageIndex>& 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())