mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:47:34 +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
|
@ -43,11 +43,6 @@ public:
|
|||
return m_type == other.m_type && m_value == other.m_value;
|
||||
}
|
||||
|
||||
bool operator!=(Angle const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
private:
|
||||
StringView unit_name() const;
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@ public:
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool operator!=(Display const& other) const { return !(*this == other); }
|
||||
|
||||
enum class Outside {
|
||||
Block,
|
||||
Inline,
|
||||
|
|
|
@ -40,11 +40,6 @@ public:
|
|||
return m_type == other.m_type && m_value == other.m_value;
|
||||
}
|
||||
|
||||
bool operator!=(Frequency const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
private:
|
||||
StringView unit_name() const;
|
||||
|
||||
|
|
|
@ -121,10 +121,6 @@ public:
|
|||
// We have a RefPtr<CalculatedStyleValue> member, but can't include the header StyleValue.h as it includes
|
||||
// this file already. To break the cyclic dependency, we must move all method definitions out.
|
||||
bool operator==(Length const& other) const;
|
||||
bool operator!=(Length const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
float relative_length_to_px(Gfx::IntRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, float font_size, float root_font_size) const;
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ public:
|
|||
}
|
||||
|
||||
bool operator==(Percentage const& other) const { return m_value == other.m_value; }
|
||||
bool operator!=(Percentage const& other) const { return !(*this == other); }
|
||||
|
||||
private:
|
||||
float m_value;
|
||||
|
@ -147,7 +146,6 @@ public:
|
|||
return (m_value.template get<Percentage>() == other.m_value.template get<Percentage>());
|
||||
return (m_value.template get<T>() == other.m_value.template get<T>());
|
||||
}
|
||||
bool operator!=(PercentageOr<T> const& other) const { return !(*this == other); }
|
||||
|
||||
protected:
|
||||
bool is_t() const { return m_value.template has<T>(); }
|
||||
|
|
|
@ -32,11 +32,6 @@ public:
|
|||
return m_type == other.m_type && m_value == other.m_value;
|
||||
}
|
||||
|
||||
bool operator!=(Resolution const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
private:
|
||||
StringView unit_name() const;
|
||||
|
||||
|
|
|
@ -109,7 +109,6 @@ public:
|
|||
float line_height(Layout::Node const&) const;
|
||||
|
||||
bool operator==(StyleProperties const&) const;
|
||||
bool operator!=(StyleProperties const& other) const { return !(*this == other); }
|
||||
|
||||
Optional<CSS::Position> position() const;
|
||||
Optional<int> z_index() const;
|
||||
|
|
|
@ -402,7 +402,6 @@ public:
|
|||
virtual String to_string() const = 0;
|
||||
|
||||
bool operator==(StyleValue const& other) const { return equals(other); }
|
||||
bool operator!=(StyleValue const& other) const { return !(*this == other); }
|
||||
|
||||
virtual bool equals(StyleValue const& other) const = 0;
|
||||
|
||||
|
|
|
@ -41,11 +41,6 @@ public:
|
|||
return m_type == other.m_type && m_value == other.m_value;
|
||||
}
|
||||
|
||||
bool operator!=(Time const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
private:
|
||||
StringView unit_name() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue