summaryrefslogtreecommitdiff
path: root/AK/FlyString.h
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-03-24 18:25:10 +0100
committerLinus Groh <mail@linusgroh.de>2023-04-06 23:49:08 +0200
commitd6cf9f53297a8fe2e8455b0502cd458cd42ba12d (patch)
tree27e8b7e6c50fa061d16a405da7c8f01a1b665c7d /AK/FlyString.h
parent3aa485aa09af5dc82aaf96ed24a9aa2796116a26 (diff)
downloadserenity-d6cf9f53297a8fe2e8455b0502cd458cd42ba12d.zip
AK: Add FlyString::is_one_of for variadic string comparison
Diffstat (limited to 'AK/FlyString.h')
-rw-r--r--AK/FlyString.h6
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.