Skip to content

Commit

Permalink
Merge pull request #1703 from heinezen/fix/ambiguous_compare
Browse files Browse the repository at this point in the history
Make comparisons not ambiguous (fixes clang warnings)
  • Loading branch information
TheJJ authored Nov 2, 2024
2 parents 31f74ee + 65d2f7a commit 45a7dd5
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions libopenage/coord/coord.h.template
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ struct Coord${camelcase}Absolute {
return static_cast<Absolute &>(*this);
}

constexpr bool operator ==(const Absolute &other) const {
return ${formatted_members("(this->{0} == other.{0})", join_with=" && ")};
}

constexpr bool operator !=(const Absolute &other) const {
return !(*this == other);
friend constexpr bool operator ==(const Absolute &lhs, const Absolute &rhs) {
return ${formatted_members("(lhs.{0} == rhs.{0})", join_with=" && ")};
}
};

Expand Down Expand Up @@ -167,12 +163,8 @@ struct Coord${camelcase}Relative {
return static_cast<Relative &>(*this);
}

constexpr bool operator ==(const Relative &other) const {
return ${formatted_members("(this->{0} == other.{0})", join_with=" && ")};
}

constexpr bool operator !=(const Relative &other) const {
return !(*this == other);
friend constexpr bool operator ==(const Relative &lhs, const Relative &rhs) {
return ${formatted_members("(lhs.{0} == rhs.{0})", join_with=" && ")};
}
};

Expand Down

0 comments on commit 45a7dd5

Please sign in to comment.