mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +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:
parent
8b55d3d86e
commit
ebd2e7d9f5
2 changed files with 3 additions and 4 deletions
|
@ -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; }
|
||||||
|
|
||||||
|
|
|
@ -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...);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue