Skip to content

Commit

Permalink
Check address in IMathObject::operator==
Browse files Browse the repository at this point in the history
  • Loading branch information
fintarin committed May 5, 2024
1 parent 37d4156 commit 32e3ea6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/fintamath/core/IMathObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class IMathObject {
virtual MathObjectClass getClass() const noexcept = 0;

friend bool operator==(const IMathObject &lhs, const IMathObject &rhs) {
if (&lhs == &rhs) {
return true;
}

return lhs.equalsAbstract(rhs);
}

Expand Down
4 changes: 4 additions & 0 deletions include/fintamath/core/IMathObjectCRTP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class IMathObjectCRTP_ : public IMathObject {
}

bool operator==(const I_MATH_OBJECT_CRTP &rhs) const {
if (this == &rhs) {
return true;
}

return equals(cast<Derived>(rhs));
}

Expand Down

0 comments on commit 32e3ea6

Please sign in to comment.