From 971020eca7c5d576816b93431607f1e63e9584a4 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 8 May 2019 16:31:52 -0700 Subject: [PATCH] Add sink support for hb_hashmap_t and a reverse call to hb_pair_t. --- src/hb-algs.hh | 5 +++++ src/hb-map.hh | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index f211242db..ca7075538 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -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 reverse () const + { + return hb_pair_t (second, first); + } + bool operator == (const pair_t& o) const { return first == o.first && second == o.second; } T1 first; diff --git a/src/hb-map.hh b/src/hb-map.hh index 9dc178880..942a301e4 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -231,6 +231,10 @@ struct hb_hashmap_t | hb_map (hb_ridentity) ) + /* Sink interface. */ + hb_hashmap_t& operator << (const hb_pair_t& v) + { set (v.first, v.second); return *this; } + protected: unsigned int bucket_for (K key) const