Affected subclause: [over.match.oper]
Change: Equality and inequality expressions can now find
reversed and rewritten candidates
. Rationale: Improve consistency of equality with three-way comparison
and make it easier to write the full complement of equality operations
. Effect on original feature: For certain pairs of types where one is convertible to the other,
equality or inequality expressions between an object of one type
and an object of the other type invoke a different operator
. Also, for certain types, equality or inequality expressions
between two objects of that type become ambiguous
. [
Example 1:
struct A {
operator int() const;
};
bool operator==(A, int);
int check(A x, A y) {
return (x == y) +
(10 == x) +
(10 != x);
}
—
end example]