From 58cde66891809c109aeeadece3e870dfc3d0f1db Mon Sep 17 00:00:00 2001 From: Quentin Grimonprez Date: Tue, 3 Oct 2023 12:02:57 +0200 Subject: [PATCH] fix(MixtComp): add const to some iterators #48 --- MixtComp/src/lib/LinAlg/Iterator.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MixtComp/src/lib/LinAlg/Iterator.h b/MixtComp/src/lib/LinAlg/Iterator.h index 4a400438f..ab26d0027 100644 --- a/MixtComp/src/lib/LinAlg/Iterator.h +++ b/MixtComp/src/lib/LinAlg/Iterator.h @@ -57,7 +57,7 @@ class Iterator { rows_(mat.rows()), p_mat_(&mat) {} - Iterator operator+(int i) { + Iterator operator+(int i) const { int posP, iP, jP; posP = pos(); posP += i; @@ -75,7 +75,7 @@ class Iterator { return *this; } - Iterator operator-(int i) { + Iterator operator-(int i) const { int posP, iP, jP; posP = pos(); posP -= i; @@ -83,9 +83,9 @@ class Iterator { return Iterator(iP, jP, *p_mat_); } - int operator-(const Iterator &it) { return pos() - it.pos(); } + int operator-(const Iterator &it) const { return pos() - it.pos(); } - bool operator<(const Iterator &it) { + bool operator<(const Iterator &it) const { if (j_ < it.j_) { return true; } else if (j_ > it.j_) { @@ -97,14 +97,14 @@ class Iterator { return false; } - bool operator==(const Iterator &it) { + bool operator==(const Iterator &it) const { if (i_ == it.i_ && j_ == it.j_) return true; else return false; } - bool operator>(const Iterator &it) { + bool operator>(const Iterator &it) const { if (j_ > it.j_) { return true; } else if (j_ > it.j_) { @@ -116,7 +116,7 @@ class Iterator { return false; } - bool operator>=(const Iterator &it) { + bool operator>=(const Iterator &it) const { if (!(*this < it)) { return true; } @@ -124,7 +124,7 @@ class Iterator { return false; } - bool operator!=(const Iterator &it) { + bool operator!=(const Iterator &it) const { if (i_ != it.i_ || j_ != it.j_) return true; else