diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-28 17:40:23 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-28 18:55:47 +0200 |
commit | ebd2e7d9f569d284effeeb53a5589318391617b8 (patch) | |
tree | 1828f837a9b41c4a0c739ab1a62c890486cfc8be | |
parent | 8b55d3d86eb304389fa2557525d13aa4538d81c9 (diff) | |
download | serenity-ebd2e7d9f569d284effeeb53a5589318391617b8.zip |
AK: Tweak String::is_one_of() and FlyString::is_one_of()
Switch the comparisons from "other == *this" to "*this == other".
-rw-r--r-- | AK/FlyString.h | 5 | ||||
-rw-r--r-- | AK/String.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/AK/FlyString.h b/AK/FlyString.h index 7862f0eee0..f69196fd5d 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -32,7 +32,7 @@ namespace AK { class FlyString { public: - FlyString() {} + FlyString() { } FlyString(const FlyString& other) : m_impl(other.impl()) { @@ -93,12 +93,11 @@ public: template<typename T, typename... Rest> bool is_one_of(const T& string, Rest... rest) const { - if (string == *this) + if (*this == string) return true; return is_one_of(rest...); } - private: bool is_one_of() const { return false; } diff --git a/AK/String.h b/AK/String.h index 1d04b9fafa..3c175562d3 100644 --- a/AK/String.h +++ b/AK/String.h @@ -230,7 +230,7 @@ public: template<typename T, typename... Rest> bool is_one_of(const T& string, Rest... rest) const { - if (string == *this) + if (*this == string) return true; return is_one_of(rest...); } |