From 22a66bb1c2afde93096d9866d6386e2bca955f71 Mon Sep 17 00:00:00 2001 From: Jonne Ransijn Date: Sun, 27 Oct 2024 00:37:14 +0200 Subject: [PATCH] AK: Pass `(Deprecated)FlyString::is_one_of` arguments by reference This avoid unnecessairy reference counting. --- AK/DeprecatedFlyString.h | 2 +- AK/FlyString.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AK/DeprecatedFlyString.h b/AK/DeprecatedFlyString.h index ba709660e18..80087aa48f7 100644 --- a/AK/DeprecatedFlyString.h +++ b/AK/DeprecatedFlyString.h @@ -84,7 +84,7 @@ public: static void did_destroy_impl(Badge, StringImpl&); 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/FlyString.h b/AK/FlyString.h index 1e1cd169009..fd2c21e51a9 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -74,7 +74,7 @@ public: [[nodiscard]] bool ends_with_bytes(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) 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))); }