From de6e0465e709a6951d5683956c7adf00749a58ad Mon Sep 17 00:00:00 2001 From: ancarola Date: Fri, 28 Jun 2019 22:25:12 +0200 Subject: Small correction on interators --- include/mm/mmmatrix.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mm/mmmatrix.hpp b/include/mm/mmmatrix.hpp index d366df2..7834a3e 100644 --- a/include/mm/mmmatrix.hpp +++ b/include/mm/mmmatrix.hpp @@ -574,7 +574,7 @@ T& mm::vector_iterator::operator*() const else if constexpr (IterType == MM_COL_ITER) return M.data[index * Cols + position]; else if constexpr (IterType == MM_DIAG_ITER) - return (k > 0) ? + return (position > 0) ? M.data[(index + position) * Cols + index] : M.data[index * Cols + (index - position)]; } @@ -587,7 +587,7 @@ T& mm::vector_iterator::operator[](std::size_t i) else if constexpr (IterType == MM_COL_ITER) return M.data[i * Cols + position]; else if constexpr (IterType == MM_DIAG_ITER) - return (k > 0) ? + return (position > 0) ? M.data[(i + position) * Cols + i] : M.data[i * Cols + (i - position)]; } -- cgit v1.2.1