diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 141165028..5aa138fbc 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -147,16 +147,18 @@ struct hb_iter_t using Name::operator <<; \ static_assert (true, "") -/* Returns iterator type of a type. */ -#define hb_iter_t(Iterable) decltype (hb_deref (hb_declval (Iterable)).iter ()) +/* Returns iterator / item type of a type. */ +template +using hb_iter_type = decltype (hb_deref (hb_declval (Iterable)).iter ()); +template +using hb_item_type = decltype (*hb_deref (hb_declval (Iterable)).iter ()); template struct hb_array_t; struct { - template - hb_iter_t (T) + template hb_iter_type operator () (T&& c) const { return hb_deref (hb_forward (c)).iter (); } @@ -487,9 +489,9 @@ struct { template - hb_zip_iter_t + hb_zip_iter_t, hb_iter_type> operator () (A& a, B &b) const - { return hb_zip_iter_t (hb_iter (a), hb_iter (b)); } + { return hb_zip_iter_t, hb_iter_type> (hb_iter (a), hb_iter (b)); } } HB_FUNCOBJ (hb_zip); @@ -534,9 +536,9 @@ struct { template - hb_enumerate_iter_t + hb_enumerate_iter_t> operator () (Iterable&& it) const - { return hb_enumerate_iter_t (hb_iter (it)); } + { return hb_enumerate_iter_t> (hb_iter (it)); } } HB_FUNCOBJ (hb_enumerate);