[iter] Add hb_drain
This commit is contained in:
parent
f4cfd6b6ad
commit
fa35d3fd81
|
@ -430,6 +430,17 @@ static const struct
|
|||
{ return hb_sink_t<Sink&> (*s); }
|
||||
} hb_sink HB_UNUSED;
|
||||
|
||||
static const struct
|
||||
{
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
void
|
||||
operator () (Iter it) const
|
||||
{
|
||||
for (; it; ++it)
|
||||
(void) *it;
|
||||
}
|
||||
} hb_drain HB_UNUSED;
|
||||
|
||||
/*
|
||||
* Algorithms operating on iterators.
|
||||
|
|
|
@ -149,7 +149,12 @@ main (int argc, char **argv)
|
|||
;
|
||||
|
||||
+ hb_iter (src)
|
||||
| hb_apply (&st);
|
||||
| hb_apply (&st)
|
||||
;
|
||||
|
||||
+ hb_iter (src)
|
||||
| hb_drain
|
||||
;
|
||||
|
||||
t << 1;
|
||||
long vl;
|
||||
|
|
Loading…
Reference in New Issue