提交 a3048271 编写于 作者: B Behdad Esfahbod

[map] Add .values() iterator

上级 3c69505b
......@@ -216,12 +216,16 @@ struct hb_hashmap_t
| hb_filter (&item_t::is_real)
| hb_map (&item_t::get_pair)
)
auto keys () const HB_AUTO_RETURN
(
+ iter()
| hb_map (&hb_pair_t<K, V>::first)
)
auto values () const HB_AUTO_RETURN
(
+ iter()
| hb_map (&hb_pair_t<K, V>::second)
)
protected:
......
......@@ -215,6 +215,14 @@ main (int argc, char **argv)
using map_key_t = decltype (*m.keys());
+ hb_iter (m.keys ())
| hb_filter ([] (map_key_t k) { return k < 42; })
| hb_drain
;
m.values ();
using map_value_t = decltype (*m.values());
+ hb_iter (m.values ())
| hb_filter ([] (map_value_t k) { return k < 42; })
| hb_drain
;
unsigned int temp1 = 10;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册