Skip to content

Commit 45a7dd5

Browse files
authored
Merge pull request #1703 from heinezen/fix/ambiguous_compare
Make comparisons not ambiguous (fixes clang warnings)
2 parents 31f74ee + 65d2f7a commit 45a7dd5

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

libopenage/coord/coord.h.template

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,8 @@ struct Coord${camelcase}Absolute {
7474
return static_cast<Absolute &>(*this);
7575
}
7676

77-
constexpr bool operator ==(const Absolute &other) const {
78-
return ${formatted_members("(this->{0} == other.{0})", join_with=" && ")};
79-
}
80-
81-
constexpr bool operator !=(const Absolute &other) const {
82-
return !(*this == other);
77+
friend constexpr bool operator ==(const Absolute &lhs, const Absolute &rhs) {
78+
return ${formatted_members("(lhs.{0} == rhs.{0})", join_with=" && ")};
8379
}
8480
};
8581

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

170-
constexpr bool operator ==(const Relative &other) const {
171-
return ${formatted_members("(this->{0} == other.{0})", join_with=" && ")};
172-
}
173-
174-
constexpr bool operator !=(const Relative &other) const {
175-
return !(*this == other);
166+
friend constexpr bool operator ==(const Relative &lhs, const Relative &rhs) {
167+
return ${formatted_members("(lhs.{0} == rhs.{0})", join_with=" && ")};
176168
}
177169
};
178170

0 commit comments

Comments
 (0)