From d0261bd26c3900a5e52da3574fc2aeab3392c30b Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sat, 30 Nov 2013 10:42:23 +0100 Subject: [PATCH] Fix swap in DenseBase --- Eigen/src/Core/DenseBase.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 4794c2f13..50a63c85c 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -387,7 +387,29 @@ template class DenseBase // size types on MSVC. return typename internal::eval::type(derived()); } + +#ifdef EIGEN_TEST_EVALUATORS + /** swaps *this with the expression \a other. + * + */ + template + EIGEN_DEVICE_FUNC + void swap(const DenseBase& other, + int = OtherDerived::ThisConstantIsPrivateInPlainObjectBase) + { + swap_using_evaluator(derived(), other.derived()); + } + /** swaps *this with the matrix or array \a other. + * + */ + template + EIGEN_DEVICE_FUNC + void swap(PlainObjectBase& other) + { + swap_using_evaluator(derived(), other.derived()); + } +#else // EIGEN_TEST_EVALUATORS /** swaps *this with the expression \a other. * */ @@ -408,7 +430,7 @@ template class DenseBase { SwapWrapper(derived()).lazyAssign(other.derived()); } - +#endif // EIGEN_TEST_EVALUATORS EIGEN_DEVICE_FUNC inline const NestByValue nestByValue() const; EIGEN_DEVICE_FUNC inline const ForceAlignedAccess forceAlignedAccess() const;