diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-04-01 00:39:56 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-04-01 00:39:56 +0000 |
commit | 113fc3a2606997533287921ccec49e320bf9f79b (patch) | |
tree | 8b957dca70499806ee0ed756d3a817a3db0b0604 /Eigen/src/Core/Coeffs.h | |
parent | 2f45eeb0c6cfb607767886d295e1de3e59c958fb (diff) |
now if Derived has the DirectAccess flag, then MatrixBase<Derived>::coeff() const returns a const Scalar& and not a Scalar as before.
useful for people doing direct access. + 1 bugfix thanks to Patrick Mihelich, forgot a & in MapBase::coeff(int).
Diffstat (limited to 'Eigen/src/Core/Coeffs.h')
-rw-r--r-- | Eigen/src/Core/Coeffs.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Eigen/src/Core/Coeffs.h b/Eigen/src/Core/Coeffs.h index 23a84228b..b514dcd17 100644 --- a/Eigen/src/Core/Coeffs.h +++ b/Eigen/src/Core/Coeffs.h @@ -40,7 +40,7 @@ * \sa operator()(int,int) const, coeffRef(int,int), coeff(int) const */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::coeff(int row, int col) const { ei_internal_assert(row >= 0 && row < rows() @@ -53,7 +53,7 @@ EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived * \sa operator()(int,int), operator[](int) const */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::operator()(int row, int col) const { ei_assert(row >= 0 && row < rows() @@ -112,7 +112,7 @@ EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived> * \sa operator[](int) const, coeffRef(int), coeff(int,int) const */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::coeff(int index) const { ei_internal_assert(index >= 0 && index < size()); @@ -127,7 +127,7 @@ EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived * z() const, w() const */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::operator[](int index) const { ei_assert(index >= 0 && index < size()); @@ -144,7 +144,7 @@ EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived * z() const, w() const */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::operator()(int index) const { ei_assert(index >= 0 && index < size()); @@ -205,22 +205,22 @@ EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived> /** equivalent to operator[](0). */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::x() const { return (*this)[0]; } /** equivalent to operator[](1). */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::y() const { return (*this)[1]; } /** equivalent to operator[](2). */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::z() const { return (*this)[2]; } /** equivalent to operator[](3). */ template<typename Derived> -EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::CoeffReturnType MatrixBase<Derived> ::w() const { return (*this)[3]; } /** equivalent to operator[](0). */ |