mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 21:37:35 +00:00
Everywhere: Remove redundant inequality comparison operators
C++20 can automatically synthesize `operator!=` from `operator==`, so there is no point in writing such functions by hand if all they do is call through to `operator==`. This fixes a compile error with compilers that implement P2468 (Clang 16 currently). This paper restores the C++17 behavior that if both `T::operator==(U)` and `T::operator!=(U)` exist, `U == T` won't be rewritten in reverse to call `T::operator==(U)`. Removing `!=` operators makes the rewriting possible again. See https://reviews.llvm.org/D134529#3853062
This commit is contained in:
parent
4e406b0730
commit
4296425bd8
40 changed files with 1 additions and 180 deletions
|
@ -350,11 +350,6 @@ public:
|
|||
return m_value == other.m_value;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(Color const& other) const
|
||||
{
|
||||
return m_value != other.m_value;
|
||||
}
|
||||
|
||||
String to_string() const;
|
||||
String to_string_without_alpha() const;
|
||||
static Optional<Color> from_string(StringView);
|
||||
|
|
|
@ -132,12 +132,6 @@ public:
|
|||
return x() == other.x() && y() == other.y();
|
||||
}
|
||||
|
||||
template<class U>
|
||||
[[nodiscard]] bool operator!=(Point<U> const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
[[nodiscard]] Point<T> operator+(Point<T> const& other) const { return { m_x + other.m_x, m_y + other.m_y }; }
|
||||
|
||||
Point<T>& operator+=(Point<T> const& other)
|
||||
|
|
|
@ -477,12 +477,6 @@ public:
|
|||
return location() == other.location() && size() == other.size();
|
||||
}
|
||||
|
||||
template<class U>
|
||||
[[nodiscard]] bool operator!=(Rect<U> const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
[[nodiscard]] Rect<T> operator*(T factor) const { return { m_location * factor, m_size * factor }; }
|
||||
|
||||
Rect<T>& operator*=(T factor)
|
||||
|
|
|
@ -99,12 +99,6 @@ public:
|
|||
return width() == other.width() && height() == other.height();
|
||||
}
|
||||
|
||||
template<class U>
|
||||
[[nodiscard]] constexpr bool operator!=(Size<U> const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
constexpr Size<T>& operator-=(Size<T> const& other)
|
||||
{
|
||||
m_width -= other.m_width;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue