1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

AK: Tweak String::is_one_of() and FlyString::is_one_of()

Switch the comparisons from "other == *this" to "*this == other".
This commit is contained in:
Andreas Kling 2020-07-28 17:40:23 +02:00
parent 8b55d3d86e
commit ebd2e7d9f5
2 changed files with 3 additions and 4 deletions

View file

@ -32,7 +32,7 @@ namespace AK {
class FlyString { class FlyString {
public: public:
FlyString() {} FlyString() { }
FlyString(const FlyString& other) FlyString(const FlyString& other)
: m_impl(other.impl()) : m_impl(other.impl())
{ {
@ -93,12 +93,11 @@ public:
template<typename T, typename... Rest> template<typename T, typename... Rest>
bool is_one_of(const T& string, Rest... rest) const bool is_one_of(const T& string, Rest... rest) const
{ {
if (string == *this) if (*this == string)
return true; return true;
return is_one_of(rest...); return is_one_of(rest...);
} }
private: private:
bool is_one_of() const { return false; } bool is_one_of() const { return false; }

View file

@ -230,7 +230,7 @@ public:
template<typename T, typename... Rest> template<typename T, typename... Rest>
bool is_one_of(const T& string, Rest... rest) const bool is_one_of(const T& string, Rest... rest) const
{ {
if (string == *this) if (*this == string)
return true; return true;
return is_one_of(rest...); return is_one_of(rest...);
} }