提交 183b8094 编写于 作者: R rsheeter 提交者: Behdad Esfahbod

[map] add iteration

上级 df237d2f
......@@ -62,6 +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_object_header_t header;
......@@ -206,6 +207,16 @@ struct hb_hashmap_t
unsigned int get_population () const { return population; }
/*
* Iterator
*/
auto iter() const HB_AUTO_RETURN
(
+ hb_array_t<item_t> (items, mask + 1)
| hb_filter (&item_t::is_real)
| hb_map (&item_t::get_pair)
)
protected:
unsigned int bucket_for (K key) const
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册