Modernize comparison operators
This did hit me like a truck.
If you define operator ==, then you have also operator != for free, there is absolutely no need to define it.
I'd suggest the following to modernize our code:
- If possible, define the three-way comparison
R operator<=>(const T& a, const U& b), and remove any other comparison operator. - If ordering is not possible (no "greater" or "lesser" definition), only define
bool operator==(const T& a, const U& b);. Remove any other comparison operator. - Clarify this point in the coding guidelines.
Note that the 3-way comparison requires one to decide if the ordering is strong, partial, or weak, see https://en.cppreference.com/w/cpp/header/compare.html
Edited by Tommaso Pecorella