diff --git a/AK/FlyString.h b/AK/FlyString.h index 8f92396928b..d3423522c51 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -88,6 +88,16 @@ public: static void did_destroy_impl(Badge, StringImpl&); + bool is_one_of() { return false; } + template + bool is_one_of(const T& string, Rest... rest) + { + if (string == *this) + return true; + return is_one_of(rest...); + } + + private: RefPtr m_impl; }; diff --git a/AK/String.h b/AK/String.h index 1f06490696e..e882b8919fc 100644 --- a/AK/String.h +++ b/AK/String.h @@ -58,9 +58,9 @@ class String { public: using ConstIterator = const char*; - ~String() {} + ~String() { } - String() {} + String() { } String(const StringView&); String(const String& other) @@ -224,6 +224,15 @@ public: int replace(const String& needle, const String& replacement, bool all_occurences = false); + bool is_one_of() { return false; } + template + bool is_one_of(const T& string, Rest... rest) + { + if (string == *this) + return true; + return is_one_of(rest...); + } + private: RefPtr m_impl; };