fix bug in hb_hashmap_t has() interface
It was not working when the value type is hb_bytes_t because hb_array_t overloaded operator &
This commit is contained in:
parent
d1f445ec1e
commit
dbb7f47b19
|
@ -221,7 +221,7 @@ struct hb_hashmap_t
|
||||||
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)
|
||||||
{
|
{
|
||||||
if (vp) *vp = &items[i].value;
|
if (vp) *vp = std::addressof (items[i].value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -240,5 +240,15 @@ main (int argc, char **argv)
|
||||||
m1->set (2,4);
|
m1->set (2,4);
|
||||||
assert (!m.has (p2));
|
assert (!m.has (p2));
|
||||||
}
|
}
|
||||||
|
/* Test value type with hb_bytes_t. */
|
||||||
|
{
|
||||||
|
hb_hashmap_t<int, hb_bytes_t> m;
|
||||||
|
char c_str[] = "Test";
|
||||||
|
hb_bytes_t bytes (c_str, 4);
|
||||||
|
|
||||||
|
m.set (1, bytes);
|
||||||
|
assert (m.has (1));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue