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

Whitespace

上级 a17f0fa3
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册