Whitespace

This commit is contained in:
Behdad Esfahbod 2019-05-08 14:46:55 -07:00
parent a17f0fa3a1
commit f5705d7656
2 changed files with 12 additions and 9 deletions

View File

@ -210,16 +210,16 @@ struct hb_hashmap_t
/*
* Iterator
*/
auto iter() const HB_AUTO_RETURN
auto iter () const HB_AUTO_RETURN
(
+ hb_array (items, mask + 1)
| hb_filter (&item_t::is_real)
| hb_map (&item_t::get_pair)
)
auto keys() const HB_AUTO_RETURN
auto keys () const HB_AUTO_RETURN
(
+ iter()
+ iter()
| hb_map (&hb_pair_t<K, V>::first)
)
@ -233,9 +233,9 @@ struct hb_hashmap_t
while (!items[i].is_unused ())
{
if (items[i] == key)
return i;
return i;
if (tombstone == (unsigned) -1 && items[i].is_tombstone ())
tombstone = i;
tombstone = i;
i = (i + ++step) & mask;
}
return tombstone == (unsigned) -1 ? i : tombstone;

View File

@ -208,11 +208,14 @@ main (int argc, char **argv)
using map_pair_t = hb_item_type<hb_map_t>;
+ hb_iter (m)
| hb_map ([] (map_pair_t p) { return p.first * p.second; });
| 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; });
m.keys ();
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;