[iter] Add hb_len() function-object

This commit is contained in:
Behdad Esfahbod 2019-03-28 21:34:47 -07:00
parent a030ce4ff8
commit f639b9a8ea
2 changed files with 10 additions and 0 deletions

View File

@ -145,6 +145,14 @@ static const struct
} hb_iter HB_UNUSED;
static const struct
{
template <typename T>
unsigned
operator () (T&& c) const
{ return hb_iter (c).len (); }
} hb_len HB_UNUSED;
/* Mixin to fill in what the subclass doesn't provide. */
template <typename iter_t, typename item_t = typename iter_t::__item_t__>

View File

@ -158,6 +158,8 @@ main (int argc, char **argv)
| hb_drain
;
hb_len (src);
t << 1;
long vl;
s >> vl;