From ebd2e7d9f569d284effeeb53a5589318391617b8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 28 Jul 2020 17:40:23 +0200 Subject: [PATCH] AK: Tweak String::is_one_of() and FlyString::is_one_of() Switch the comparisons from "other == *this" to "*this == other". --- AK/FlyString.h | 5 ++--- 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 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 bool is_one_of(const T& string, Rest... rest) const { - if (string == *this) + if (*this == string) return true; return is_one_of(rest...); }