bug #903: clean swap API regarding extra enable_if parameters, and add failtests for swap

This commit is contained in:
Gael Guennebaud
2014-11-06 09:25:26 +01:00
parent c6fefe5d8e
commit 722916e19d
9 changed files with 61 additions and 31 deletions

View File

@@ -41,9 +41,15 @@ template<typename MatrixType> void swap(const MatrixType& m)
OtherMatrixType m3_copy = m3;
// test swapping 2 matrices of same type
Scalar *d1=m1.data(), *d2=m2.data();
m1.swap(m2);
VERIFY_IS_APPROX(m1,m2_copy);
VERIFY_IS_APPROX(m2,m1_copy);
if(MatrixType::SizeAtCompileTime==Dynamic)
{
VERIFY(m1.data()==d2);
VERIFY(m2.data()==d1);
}
m1 = m1_copy;
m2 = m2_copy;