1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08: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:
Daniel Bertalan 2022-10-21 15:53:20 +02:00 committed by Andrew Kaster
parent 4e406b0730
commit 4296425bd8
40 changed files with 1 additions and 180 deletions

View file

@ -80,7 +80,6 @@ public:
T& operator*() { return *m_value; }
auto operator->() { return m_value; }
bool operator==(Iterator const& other) const { return other.m_value == m_value; }
bool operator!=(Iterator const& other) const { return !(*this == other); }
Iterator& operator++()
{
m_value = IntrusiveList<T, Container, member>::next(m_value);
@ -108,7 +107,6 @@ public:
T& operator*() { return *m_value; }
auto operator->() { return m_value; }
bool operator==(ReverseIterator const& other) const { return other.m_value == m_value; }
bool operator!=(ReverseIterator const& other) const { return !(*this == other); }
ReverseIterator& operator++()
{
m_value = IntrusiveList<T, Container, member>::prev(m_value);
@ -134,7 +132,6 @@ public:
T const& operator*() const { return *m_value; }
auto operator->() const { return m_value; }
bool operator==(ConstIterator const& other) const { return other.m_value == m_value; }
bool operator!=(ConstIterator const& other) const { return !(*this == other); }
ConstIterator& operator++()
{
m_value = IntrusiveList<T, Container, member>::next(m_value);