From a982fdf3e6f96b25fb8982feb50a68f14a4c387d Mon Sep 17 00:00:00 2001 From: deal Date: Tue, 28 Dec 2021 17:59:44 +0800 Subject: [PATCH] Update hlookup.h --- cocos/base/hlookup.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cocos/base/hlookup.h b/cocos/base/hlookup.h index f271224def..a58ddbbf99 100644 --- a/cocos/base/hlookup.h +++ b/cocos/base/hlookup.h @@ -7,6 +7,7 @@ #include #include #include +#include #include "tsl/robin_map.h" #include "tsl/robin_set.h" @@ -47,13 +48,13 @@ using string_map = tsl::robin_map; using string_set = tsl::robin_set; template -inline auto set_item(_Cont& cont, std::string_view key, _Valty&& _Val) +inline auto set_item(_Cont& cont, std::string_view k, _Valty&& v) { - typename _Cont::iterator it = cont.find(key); + typename _Cont::iterator it = cont.find(k); if (it != cont.end()) - it->second = std::move(_Val); + it->second = std::forward<_Valty>(v); else - it = cont.emplace(std::string{key}, std::forward<_Valty>(_Val)).first; + it = cont.emplace(std::string{key}, std::forward<_Valty>(v)).first; return it; }