[map] Add .values() iterator
This commit is contained in:
parent
3c69505b3a
commit
a304827184
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue