diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-03-24 18:25:10 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-06 23:49:08 +0200 |
commit | d6cf9f53297a8fe2e8455b0502cd458cd42ba12d (patch) | |
tree | 27e8b7e6c50fa061d16a405da7c8f01a1b665c7d /AK/FlyString.h | |
parent | 3aa485aa09af5dc82aaf96ed24a9aa2796116a26 (diff) | |
download | serenity-d6cf9f53297a8fe2e8455b0502cd458cd42ba12d.zip |
AK: Add FlyString::is_one_of for variadic string comparison
Diffstat (limited to 'AK/FlyString.h')
-rw-r--r-- | AK/FlyString.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/AK/FlyString.h b/AK/FlyString.h index a2e68cef47..f6f09b2122 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -58,6 +58,12 @@ public: // Compare this FlyString against another string with ASCII caseless matching. [[nodiscard]] bool equals_ignoring_ascii_case(FlyString const&) const; + template<typename... Ts> + [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts... strings) const + { + return (... || this->operator==(forward<Ts>(strings))); + } + private: // This will hold either the pointer to the Detail::StringData it represents or the raw bytes of // an inlined short string. |