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
Notes:
sideshowbarker
2024-07-19 04:30:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ebd2e7d9f56
2 changed files with 3 additions and 4 deletions
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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...);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue