Skip to content

Commit

Permalink
AK: Pass (Deprecated)FlyString::is_one_of arguments by reference
Browse files Browse the repository at this point in the history
This avoid unnecessairy reference counting.

(cherry picked from commit 22a66bb1c2afde93096d9866d6386e2bca955f71)
  • Loading branch information
yyny authored and nico committed Nov 15, 2024
1 parent fcfe89e commit 18b020a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AK/DeprecatedFlyString.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class DeprecatedFlyString {
static void did_destroy_impl(Badge<StringImpl>, StringImpl&);

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)));
}
Expand Down
2 changes: 1 addition & 1 deletion AK/FlyString.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class FlyString {
[[nodiscard]] bool ends_with_bytes(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) 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)));
}
Expand Down

0 comments on commit 18b020a

Please sign in to comment.