Add sink support for hb_hashmap_t and a reverse call to hb_pair_t.

This commit is contained in:
Garret Rieger 2019-05-08 16:31:52 -07:00
parent 98eec3dd5f
commit 971020eca7
2 changed files with 9 additions and 0 deletions

View File

@ -217,6 +217,11 @@ struct hb_pair_t
hb_pair_t (T1 a, T2 b) : first (a), second (b) {}
hb_pair_t (const pair_t& o) : first (o.first), second (o.second) {}
hb_pair_t<T1, T2> reverse () const
{
return hb_pair_t<T1, T2> (second, first);
}
bool operator == (const pair_t& o) const { return first == o.first && second == o.second; }
T1 first;

View File

@ -231,6 +231,10 @@ struct hb_hashmap_t
| hb_map (hb_ridentity)
)
/* Sink interface. */
hb_hashmap_t<K, V, kINVALID, vINVALID>& operator << (const hb_pair_t<K, V>& v)
{ set (v.first, v.second); return *this; }
protected:
unsigned int bucket_for (K key) const