[map] Don't set out value in has() if not found

This commit is contained in:
Behdad Esfahbod 2022-07-20 14:38:28 -06:00
parent 485f043211
commit 00cfc5c17d
1 changed files with 0 additions and 6 deletions

View File

@ -222,10 +222,7 @@ struct hb_hashmap_t
bool has (K key, const V **vp = nullptr) const
{
if (unlikely (!items))
{
if (vp) *vp = &item_t::default_value ();
return false;
}
unsigned int i = bucket_for (key);
if (items[i].is_real () && items[i] == key)
{
@ -233,10 +230,7 @@ struct hb_hashmap_t
return true;
}
else
{
if (vp) *vp = &item_t::default_value ();
return false;
}
}
/* Projection. */
V operator () (K k) const { return get (k); }