[iter] Accept iterator, not iterable, in hb_sink()()

This commit is contained in:
Behdad Esfahbod 2019-02-14 10:51:02 -08:00
parent 0f292ea85f
commit 5fa52e62b1
2 changed files with 5 additions and 4 deletions

View File

@ -371,12 +371,12 @@ struct hb_sink_t
{ {
hb_sink_t (Sink&& s) : s (s) {} hb_sink_t (Sink&& s) : s (s) {}
template <typename Iterable, template <typename Iter,
hb_enable_if (hb_is_iterable (Iterable))> hb_enable_if (hb_is_iterator (Iter))>
void void
operator () (const Iterable &c) const operator () (Iter it) const
{ {
for (auto it = c.iter (); it; ++it) for (; it; ++it)
s << *it; s << *it;
} }

View File

@ -145,6 +145,7 @@ main (int argc, char **argv)
| hb_filter () | hb_filter ()
| hb_filter (hb_bool) | hb_filter (hb_bool)
| hb_filter (hb_bool, hb_identity) | hb_filter (hb_bool, hb_identity)
| hb_sink (st)
; ;
t << 1; t << 1;