AK: Add a `is_one_of()' to StringView

This copies the similar API from String.
This commit is contained in:
AnotherTest 2020-10-28 01:28:11 +03:30 committed by Andreas Kling
parent f4b7a688b1
commit f0e59f2dac
Notes: sideshowbarker 2024-07-19 01:40:04 +09:00

View file

@ -180,7 +180,17 @@ public:
const char* begin() { return m_characters; }
const char* end() { return m_characters + m_length; }
template<typename T, typename... Rest>
bool is_one_of(const T& string, Rest... rest) const
{
if (*this == string)
return true;
return is_one_of(rest...);
}
private:
bool is_one_of() const { return false; }
friend class String;
const StringImpl* m_impl { nullptr };
const char* m_characters { nullptr };