[map] add a test for iteration
This commit is contained in:
parent
183b8094b5
commit
ba60512813
|
@ -62,7 +62,7 @@ struct hb_hashmap_t
|
||||||
bool is_unused () const { return key == kINVALID; }
|
bool is_unused () const { return key == kINVALID; }
|
||||||
bool is_tombstone () const { return key != kINVALID && value == vINVALID; }
|
bool is_tombstone () const { return key != kINVALID && value == vINVALID; }
|
||||||
bool is_real () 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;
|
hb_object_header_t header;
|
||||||
|
|
|
@ -206,6 +206,10 @@ main (int argc, char **argv)
|
||||||
| hb_reduce ([&] (int acc, int value) -> int { return acc; }, 2)
|
| 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 temp1 = 10;
|
||||||
unsigned int temp2 = 0;
|
unsigned int temp2 = 0;
|
||||||
hb_map_t *result =
|
hb_map_t *result =
|
||||||
|
|
Loading…
Reference in New Issue