Skip to content

Commit

Permalink
fix(MixtComp): add const to some iterators #48
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin62 committed Oct 3, 2023
1 parent 25c0fdd commit 58cde66
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions MixtComp/src/lib/LinAlg/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -75,17 +75,17 @@ class Iterator {
return *this;
}

Iterator operator-(int i) {
Iterator operator-(int i) const {
int posP, iP, jP;
posP = pos();
posP -= i;
posToIn(posP, iP, jP);
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_) {
Expand All @@ -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_) {
Expand All @@ -116,15 +116,15 @@ class Iterator {
return false;
}

bool operator>=(const Iterator &it) {
bool operator>=(const Iterator &it) const {
if (!(*this < it)) {
return true;
}

return false;
}

bool operator!=(const Iterator &it) {
bool operator!=(const Iterator &it) const {
if (i_ != it.i_ || j_ != it.j_)
return true;
else
Expand Down

0 comments on commit 58cde66

Please sign in to comment.