AK: Make {String,FlyString}::is_one_of() const

Also, make the zero-argument variant private since it's not meant to be
called by clients directly.
This commit is contained in:
Andreas Kling 2020-05-29 21:44:06 +02:00
parent 2b1517f215
commit 643464c455
Notes: sideshowbarker 2024-07-19 05:58:02 +09:00
2 changed files with 6 additions and 4 deletions

View file

@ -89,9 +89,8 @@ public:
static void did_destroy_impl(Badge<StringImpl>, StringImpl&);
bool is_one_of() { return false; }
template<typename T, typename... Rest>
bool is_one_of(const T& string, Rest... rest)
bool is_one_of(const T& string, Rest... rest) const
{
if (string == *this)
return true;
@ -100,6 +99,8 @@ public:
private:
bool is_one_of() const { return false; }
RefPtr<StringImpl> m_impl;
};

View file

@ -224,9 +224,8 @@ public:
int replace(const String& needle, const String& replacement, bool all_occurences = false);
bool is_one_of() { return false; }
template<typename T, typename... Rest>
bool is_one_of(const T& string, Rest... rest)
bool is_one_of(const T& string, Rest... rest) const
{
if (string == *this)
return true;
@ -234,6 +233,8 @@ public:
}
private:
bool is_one_of() const { return false; }
RefPtr<StringImpl> m_impl;
};