Skip to content

Commit

Permalink
AK: Add a `is_one_of()' to StringView
Browse files Browse the repository at this point in the history
This copies the similar API from String.
  • Loading branch information
alimpfard authored and awesomekling committed Oct 29, 2020
1 parent f4b7a68 commit f0e59f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions AK/StringView.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,17 @@ class StringView {
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 };
Expand Down

0 comments on commit f0e59f2

Please sign in to comment.