summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-07-31 19:27:25 -0400
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-08-02 21:02:09 +0430
commit011514a3840c312c5fe122eb707b8f297e87e1b7 (patch)
treea4d23285d1eac93f01b5e38e20ac05362c30131c /AK
parent1e10d6d7ce70dafd638747fadc6874a47d0448db (diff)
downloadserenity-011514a3840c312c5fe122eb707b8f297e87e1b7.zip
AK: Fix declaration of {String,StringView}::is_one_of
The declarations need to consume the variadic parameters as "Ts&&..." for the parameters to be forwarding references.
Diffstat (limited to 'AK')
-rw-r--r--AK/String.h2
-rw-r--r--AK/StringView.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/AK/String.h b/AK/String.h
index d59b00c3b0..79f66347bb 100644
--- a/AK/String.h
+++ b/AK/String.h
@@ -287,7 +287,7 @@ public:
[[nodiscard]] String reverse() const;
template<typename... Ts>
- [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts... strings) const
+ [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts&&... strings) const
{
return (... || this->operator==(forward<Ts>(strings)));
}
diff --git a/AK/StringView.h b/AK/StringView.h
index 2d03af4eac..519e5afdf8 100644
--- a/AK/StringView.h
+++ b/AK/StringView.h
@@ -216,7 +216,7 @@ public:
[[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); }
template<typename... Ts>
- [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts... strings) const
+ [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts&&... strings) const
{
return (... || this->operator==(forward<Ts>(strings)));
}