[iter] Add hb_iter_of_t<>
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 2 Jan 2019 21:43:52 +0000 (16:43 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 21 Jan 2019 01:12:12 +0000 (20:12 -0500)
src/hb-iter.hh

index 4cdad76..8beaa55 100644 (file)
  * Base classes for iterators.
  */
 
+template <typename Item> struct hb_iter_of_t {};
+
 /* Base class for all iterators. */
 template <typename Iter, typename Item = typename Iter::__item_type__>
-struct hb_iter_t
+struct hb_iter_t : hb_iter_of_t<Item>
 {
   typedef Iter iter_t;
   typedef Item item_t;
@@ -161,11 +163,11 @@ struct hb_is_iterable { enum { value = _hb_is_iterable<T, hb_true_t>::value }; }
 
 /* hb_is_iterator() / hb_is_sorted_iterator() */
 
-template<typename Iter = void, typename Item = void> char _hb_is_iterator (...) {};
-template<typename Iter, typename Item> int _hb_is_iterator (hb_iter_t<Iter, Item> *) {};
-template<typename Iter, typename Item> int _hb_is_iterator (hb_iter_t<Iter, const Item> *) {};
-template<typename Iter, typename Item> int _hb_is_iterator (hb_iter_t<Iter, Item&> *) {};
-template<typename Iter, typename Item> int _hb_is_iterator (hb_iter_t<Iter, const Item&> *) {};
+template<typename Item = void> char _hb_is_iterator (...) {};
+template<typename Item> int _hb_is_iterator (hb_iter_of_t<Item> *) {};
+template<typename Item> int _hb_is_iterator (hb_iter_of_t<const Item> *) {};
+template<typename Item> int _hb_is_iterator (hb_iter_of_t<Item&> *) {};
+template<typename Item> int _hb_is_iterator (hb_iter_of_t<const Item&> *) {};
 static_assert (sizeof (char) != sizeof (int), "");
 template<typename Iter, typename Item>
 struct hb_is_iterator { enum {