[map] Fix use-after-move issue

This commit is contained in:
Behdad Esfahbod 2023-06-08 11:13:33 -06:00
parent a67a7867d2
commit 0f0b3bee21

View file

@ -258,7 +258,11 @@ struct hb_hashmap_t
template <typename VV>
bool set (const K &key, VV&& value, bool overwrite = true) { return set_with_hash (key, hb_hash (key), std::forward<VV> (value), overwrite); }
template <typename VV>
bool set (K &&key, VV&& value, bool overwrite = true) { return set_with_hash (std::move (key), hb_hash (key), std::forward<VV> (value), overwrite); }
bool set (K &&key, VV&& value, bool overwrite = true)
{
uint32_t hash = hb_hash (key);
return set_with_hash (std::move (key), hash, std::forward<VV> (value), overwrite);
}
const V& get_with_hash (const K &key, uint32_t hash) const
{