mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09: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
Notes:
sideshowbarker
2024-07-17 04:44:02 +09:00
Author: https://github.com/BertalanD
Commit: 4296425bd8
Pull-request: https://github.com/SerenityOS/serenity/pull/15765
Reviewed-by: https://github.com/ADKaster ✅
40 changed files with 1 additions and 180 deletions
|
@ -223,7 +223,6 @@ public:
|
|||
[[nodiscard]] bool is_negative() const { return m_seconds < 0; }
|
||||
|
||||
bool operator==(Time const& other) const { return this->m_seconds == other.m_seconds && this->m_nanoseconds == other.m_nanoseconds; }
|
||||
bool operator!=(Time const& other) const { return !(*this == other); }
|
||||
Time operator+(Time const& other) const;
|
||||
Time& operator+=(Time const& other);
|
||||
Time operator-(Time const& other) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue