diff --git a/src/hb-map.hh b/src/hb-map.hh index 5efad8d20..df215fce5 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -301,6 +301,12 @@ struct hb_hashmap_t | hb_map (&item_t::key) | hb_map (hb_ridentity) ) + auto keys_ref () const HB_AUTO_RETURN + ( + + hb_array (items, mask ? mask + 1 : 0) + | hb_filter (&item_t::is_real) + | hb_map (&item_t::key) + ) auto values () const HB_AUTO_RETURN ( + hb_array (items, mask ? mask + 1 : 0) @@ -308,6 +314,12 @@ struct hb_hashmap_t | hb_map (&item_t::value) | hb_map (hb_ridentity) ) + auto values_ref () const HB_AUTO_RETURN + ( + + hb_array (items, mask ? mask + 1 : 0) + | hb_filter (&item_t::is_real) + | hb_map (&item_t::value) + ) /* Sink interface. */ hb_hashmap_t& operator << (const hb_pair_t& v) diff --git a/src/test-map.cc b/src/test-map.cc index 4cb248bd4..fb52d14fe 100644 --- a/src/test-map.cc +++ b/src/test-map.cc @@ -195,6 +195,11 @@ main (int argc, char **argv) m.get (hb::shared_ptr ()); m.get (hb::shared_ptr (hb_set_get_empty ())); m.iter (); + m.keys (); + m.values (); + m.iter_ref (); + m.keys_ref (); + m.values_ref (); } /* Test hb::unique_ptr. */ hb_hash (hb::unique_ptr ()); @@ -204,6 +209,8 @@ main (int argc, char **argv) m.get (hb::unique_ptr ()); m.get (hb::unique_ptr (hb_set_get_empty ())); m.iter_ref (); + m.keys_ref (); + m.values_ref (); } return 0;