diff --git a/src/hb-iter.hh b/src/hb-iter.hh index c3dac6d27..05f645729 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -478,6 +478,8 @@ static const struct { return hb_sink_t (*s); } } hb_sink HB_UNUSED; +/* hb-drain: hb_sink to void / blackhole / /dev/null. */ + static const struct { template +struct hb_unzip_t +{ + hb_unzip_t (Sink1&& s1, Sink2&& s2) : s1 (s1), s2 (s2) {} + + template + void + operator () (Iter it) const + { + for (; it; ++it) + { + const auto &v = *it; + s1 << v.first; + s2 << v.second; + } + } + + private: + Sink1 s1; + Sink2 s2; +}; +static const struct +{ + template hb_unzip_t + operator () (Sink1&& s1, Sink2&& s2) const + { return hb_unzip_t (s1, s2); } + + template hb_unzip_t + operator () (Sink1 *s1, Sink2 *s2) const + { return hb_unzip_t (*s1, *s2); } +} hb_unzip HB_UNUSED; + + /* hb-all, hb-any, hb-none. */ static const struct