[map] add keys()
This commit is contained in:
parent
ba60512813
commit
492af0f1bf
|
@ -212,11 +212,18 @@ struct hb_hashmap_t
|
|||
*/
|
||||
auto iter() const HB_AUTO_RETURN
|
||||
(
|
||||
+ hb_array_t<item_t> (items, mask + 1)
|
||||
+ hb_array (items, mask + 1)
|
||||
| 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)
|
||||
)
|
||||
// | hb_map ([&] (item_t i) { return i.key; })
|
||||
|
||||
protected:
|
||||
|
||||
unsigned int bucket_for (K key) const
|
||||
|
|
|
@ -210,6 +210,10 @@ main (int argc, char **argv)
|
|||
+ hb_iter (m)
|
||||
| hb_map ([] (map_pair_t p) { return p.first * p.second; });
|
||||
|
||||
using map_key_t = decltype (*m.keys());
|
||||
+ hb_iter (m.keys ())
|
||||
| hb_filter ([] (map_key_t k) { return k < 42; });
|
||||
|
||||
unsigned int temp1 = 10;
|
||||
unsigned int temp2 = 0;
|
||||
hb_map_t *result =
|
||||
|
|
Loading…
Reference in New Issue