diff --git a/src/hb-iter.hh b/src/hb-iter.hh index da93a5b37..e86e795d1 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -49,10 +49,9 @@ */ /* Base class for all iterators. */ -template +template struct hb_iter_t { - typedef Iter iter_t; typedef Item item_t; static constexpr unsigned item_size = hb_static_size (Item); static constexpr bool is_iterator = true; @@ -92,8 +91,10 @@ struct hb_iter_t void operator = (const hb_iter_t &o HB_UNUSED) {} }; +/* Returns iterator type of a type. */ +#define hb_iter_t(Iterable) decltype (hb_declval (Iterable).iter ()) + #define HB_ITER_USING(Name) \ - using iter_t = typename Name::iter_t; \ using item_t = typename Name::item_t; \ using Name::item_size; \ using Name::is_iterator; \ @@ -227,6 +228,7 @@ struct hb_map_iter_t : Iter it; Proj f; }; + template struct hb_map_iter_factory_t { @@ -234,8 +236,8 @@ struct hb_map_iter_factory_t template - hb_map_iter_t operator () (const Iterable &c) const - { return hb_map_iter_t (c.iter (), f); } + hb_map_iter_t operator () (const Iterable &c) const + { return hb_map_iter_t (c.iter (), f); } private: Proj f; @@ -273,8 +275,8 @@ struct hb_filter_iter_factory_t template - hb_filter_iter_t operator () (const Iterable &c) const - { return hb_filter_iter_t (c.iter (), p, f); } + hb_filter_iter_t operator () (const Iterable &c) const + { return hb_filter_iter_t (c.iter (), p, f); } private: Pred p; @@ -316,9 +318,9 @@ struct hb_zip_iter_t : }; template -inline hb_zip_iter_t +inline hb_zip_iter_t hb_zip (const A& a, const B &b) -{ return hb_zip_iter_t (a.iter (), b.iter ()); } +{ return hb_zip_iter_t (a.iter (), b.iter ()); } /* @@ -330,7 +332,7 @@ template