mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Add a `is_one_of()' to StringView
This copies the similar API from String.
This commit is contained in:
parent
f4b7a688b1
commit
f0e59f2dac
Notes:
sideshowbarker
2024-07-19 01:40:04 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/f0e59f2dac4 Pull-request: https://github.com/SerenityOS/serenity/pull/3858
1 changed files with 10 additions and 0 deletions
|
@ -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 };
|
||||
|
|
Loading…
Reference in a new issue