1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +00:00

AK/Complex: C++20-compatible comparison operators

Problem:
- Clang correctly reports non-`const` member function comparison
  operators as ambiguous.

Solution:
- Make them `const`.
This commit is contained in:
Lenny Maiorani 2021-04-18 10:52:11 -06:00 committed by Andreas Kling
parent 97f4aa166a
commit 0ac02b9084
2 changed files with 9 additions and 2 deletions

View file

@ -243,13 +243,13 @@ public:
}
template<AK::Concepts::Arithmetic U>
constexpr bool operator==(const Complex<U>& a)
constexpr bool operator==(const Complex<U>& a) const
{
return (this->real() == a.real()) && (this->imag() == a.imag());
}
template<AK::Concepts::Arithmetic U>
constexpr bool operator!=(const Complex<U>& a)
constexpr bool operator!=(const Complex<U>& a) const
{
return !(*this == a);
}