[map] add a test for iteration

This commit is contained in:
rsheeter 2019-05-08 12:09:10 -07:00 committed by Behdad Esfahbod
parent 183b8094b5
commit ba60512813
2 changed files with 5 additions and 1 deletions

View File

@ -62,7 +62,7 @@ struct hb_hashmap_t
bool is_unused () const { return key == kINVALID; }
bool is_tombstone () const { return key != kINVALID && value == vINVALID; }
bool is_real () const { return key != kINVALID && value != vINVALID; }
hb_pair_t<K, V> get_pair() const { return hb_pair (key, value); }
hb_pair_t<K, V> get_pair() const { return hb_pair_t<K, V> (key, value); }
};
hb_object_header_t header;

View File

@ -206,6 +206,10 @@ main (int argc, char **argv)
| hb_reduce ([&] (int acc, int value) -> int { return acc; }, 2)
;
using map_pair_t = decltype (*hb_iter (m));
+ hb_iter (m)
| hb_map ([] (map_pair_t p) { return p.first * p.second; });
unsigned int temp1 = 10;
unsigned int temp2 = 0;
hb_map_t *result =