C++ warnings for (in)equality operators
C++20 tries to compile a == b
as b == a
too (same for !=
). It emits a warning when the 2 variants have a different typing.
The fix is simple:
- the unary version should be
bool operator==(const T a) const
, often the second const is missing. - the binary version should be
bool operator==(const T a, const T b)
Fixing declaration with an incorrect type should remove warnings...