diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-12-22 17:45:37 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-12-22 17:45:37 -0500 |
commit | 75b7d98665dd144c44d7a113c6613f5f998be626 (patch) | |
tree | bc75d316e2ed8e679e744bc34f159dcb0f285243 /Eigen/src/Core/Swap.h | |
parent | 3b6d97b51a7e7a4b0c69ae6be44b1c16d72c2e80 (diff) |
bug #54 - really fix const correctness except in Sparse
Diffstat (limited to 'Eigen/src/Core/Swap.h')
-rw-r--r-- | Eigen/src/Core/Swap.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h index abbef4443..5fb032866 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -63,6 +63,16 @@ template<typename ExpressionType> class SwapWrapper return m_expression.const_cast_derived().coeffRef(index); } + inline Scalar& coeffRef(Index row, Index col) const + { + return m_expression.coeffRef(row, col); + } + + inline Scalar& coeffRef(Index index) const + { + return m_expression.coeffRef(index); + } + template<typename OtherDerived> void copyCoeff(Index row, Index col, const DenseBase<OtherDerived>& other) { @@ -113,18 +123,4 @@ template<typename ExpressionType> class SwapWrapper ExpressionType& m_expression; }; -/** swaps *this with the expression \a other. - * - * \note \a other is only marked for internal reasons, but of course - * it gets const-casted. One reason is that one will often call swap - * on temporary objects (hence non-const references are forbidden). - * Another reason is that lazyAssign takes a const argument anyway. - */ -template<typename Derived> -template<typename OtherDerived> -void DenseBase<Derived>::swap(DenseBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other) -{ - (SwapWrapper<Derived>(derived())).lazyAssign(other); -} - #endif // EIGEN_SWAP_H |