[map] Don't set out value in has() if not found
This commit is contained in:
parent
485f043211
commit
00cfc5c17d
|
@ -222,10 +222,7 @@ struct hb_hashmap_t
|
||||||
bool has (K key, const V **vp = nullptr) const
|
bool has (K key, const V **vp = nullptr) const
|
||||||
{
|
{
|
||||||
if (unlikely (!items))
|
if (unlikely (!items))
|
||||||
{
|
|
||||||
if (vp) *vp = &item_t::default_value ();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
unsigned int i = bucket_for (key);
|
unsigned int i = bucket_for (key);
|
||||||
if (items[i].is_real () && items[i] == key)
|
if (items[i].is_real () && items[i] == key)
|
||||||
{
|
{
|
||||||
|
@ -233,10 +230,7 @@ struct hb_hashmap_t
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (vp) *vp = &item_t::default_value ();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Projection. */
|
/* Projection. */
|
||||||
V operator () (K k) const { return get (k); }
|
V operator () (K k) const { return get (k); }
|
||||||
|
|
Loading…
Reference in New Issue