Open qchateau opened 1 year ago
As far as I understand, with C++20 rewritten expressions, an operator== defined as a member function is now symmetric and the assertion
I don't think that is entirely true. AFAIK, the compiler can rewrite A == B into B == A, but that doesn't change the fact that member operator== wil not treat left and right operator identical.
However, I'm not sure if/when that makes a practical difference.
[intentionally ignoring "and noexcept" because it's unrelated]
As far as I understand, with C++20 rewritten expressions, an
operator==
defined as a member function is now symmetric and the assertionin the guidelines does not hold anymore.
I would still teach people to define their operators as non-member because other operators are not symmetric and it's easier to have just one general rule "define operators as non-member functions".
But is my understand correct here ? If it is, do you agree we should change the wording of C.86 ?