From 011514a3840c312c5fe122eb707b8f297e87e1b7 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 31 Jul 2021 19:27:25 -0400 Subject: [PATCH] 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. --- AK/String.h | 2 +- AK/StringView.h | 2 +- 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 - [[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(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 - [[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(strings))); }