diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2022-10-21 15:53:20 +0200 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2022-11-06 10:25:08 -0700 |
commit | 4296425bd8f2212e70167118e5a76c4922565080 (patch) | |
tree | 5574318cc583989f1a3b3b96043a23b101d24b91 /Userland/Libraries/LibRegex | |
parent | 4e406b07305007c84cef637f5753c196c34fac9c (diff) | |
download | serenity-4296425bd8f2212e70167118e5a76c4922565080.zip |
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
Diffstat (limited to 'Userland/Libraries/LibRegex')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexMatch.h | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/Userland/Libraries/LibRegex/RegexMatch.h b/Userland/Libraries/LibRegex/RegexMatch.h index 04f2e0483b..56f5273857 100644 --- a/Userland/Libraries/LibRegex/RegexMatch.h +++ b/Userland/Libraries/LibRegex/RegexMatch.h @@ -310,11 +310,6 @@ public: [&](StringView view) { return view == cstring; }); } - bool operator!=(char const* cstring) const - { - return !(*this == cstring); - } - bool operator==(String const& string) const { return m_view.visit( @@ -333,11 +328,6 @@ public: [&](StringView view) { return view == string; }); } - bool operator!=(StringView other) const - { - return !(*this == other); - } - bool operator==(Utf32View const& other) const { return m_view.visit( @@ -349,11 +339,6 @@ public: [&](StringView view) { return view == RegexStringView { other }.to_string(); }); } - bool operator!=(Utf32View const& other) const - { - return !(*this == other); - } - bool operator==(Utf16View const& other) const { return m_view.visit( @@ -363,11 +348,6 @@ public: [&](StringView view) { return view == RegexStringView { other }.to_string(); }); } - bool operator!=(Utf16View const& other) const - { - return !(*this == other); - } - bool operator==(Utf8View const& other) const { return m_view.visit( @@ -377,11 +357,6 @@ public: [&](StringView view) { return other.as_string() == view; }); } - bool operator!=(Utf8View const& other) const - { - return !(*this == other); - } - bool equals(RegexStringView other) const { return other.m_view.visit([this](auto const& view) { return operator==(view); }); |