[iter] Add hb_len()
This commit is contained in:
parent
875131d478
commit
398b296f3b
|
@ -175,6 +175,14 @@ struct
|
||||||
|
|
||||||
}
|
}
|
||||||
HB_FUNCOBJ (hb_iter);
|
HB_FUNCOBJ (hb_iter);
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
template <typename T> unsigned
|
||||||
|
operator () (T&& c) const
|
||||||
|
{ return c.len (); }
|
||||||
|
|
||||||
|
}
|
||||||
|
HB_FUNCOBJ (hb_len);
|
||||||
|
|
||||||
/* Mixin to fill in what the subclass doesn't provide. */
|
/* Mixin to fill in what the subclass doesn't provide. */
|
||||||
template <typename iter_t, typename item_t = typename iter_t::__item_t__>
|
template <typename iter_t, typename item_t = typename iter_t::__item_t__>
|
||||||
|
|
|
@ -272,7 +272,7 @@ main (int argc, char **argv)
|
||||||
hb_repeat (7u);
|
hb_repeat (7u);
|
||||||
hb_repeat (nullptr);
|
hb_repeat (nullptr);
|
||||||
hb_repeat (vl);
|
hb_repeat (vl);
|
||||||
assert ((hb_range (10) | hb_take (3)).len () == 3);
|
assert (hb_len (hb_range (10) | hb_take (3)) == 3);
|
||||||
assert (hb_range (9).len () == 9);
|
assert (hb_range (9).len () == 9);
|
||||||
assert (hb_range (2, 9).len () == 7);
|
assert (hb_range (2, 9).len () == 7);
|
||||||
assert (hb_range (2, 9, 3).len () == 3);
|
assert (hb_range (2, 9, 3).len () == 3);
|
||||||
|
|
Loading…
Reference in New Issue