[iter] Make hb_sorted_array_t work as iter
Ugly, but does the job.
diff --git a/src/hb-array.hh b/src/hb-array.hh
index 52b775e..7dd02cd 100644
--- a/src/hb-array.hh
+++ b/src/hb-array.hh
@@ -194,9 +194,11 @@
template <typename Type>
struct hb_sorted_array_t :
hb_sorted_iter_t<hb_sorted_array_t<Type>, Type>,
- hb_array_t<Type>,
- hb_iter_mixin_t<hb_sorted_array_t<Type>, Type>
+ hb_array_t<Type>
{
+ typedef hb_sorted_iter_t<hb_sorted_array_t<Type>, Type> iter_base_t;
+ HB_ITER_USING (iter_base_t);
+
hb_sorted_array_t () : hb_array_t<Type> () {}
hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {}
hb_sorted_array_t (Type *array_, unsigned int length_) : hb_array_t<Type> (array_, length_) {}
diff --git a/src/hb-iter.hh b/src/hb-iter.hh
index db2ddc1..6d4adca 100644
--- a/src/hb-iter.hh
+++ b/src/hb-iter.hh
@@ -80,6 +80,24 @@
void operator = (const hb_iter_t &o HB_UNUSED) {}
};
+#define HB_ITER_USING(Name) \
+ using Name::iter; \
+ using Name::operator bool; \
+ using Name::len; \
+ using Name::operator ->; \
+ using Name::operator *; \
+ using Name::operator []; \
+ using Name::operator +=; \
+ using Name::operator ++; \
+ using Name::operator -=; \
+ using Name::operator --; \
+ using Name::operator +; \
+ using Name::operator -; \
+ using Name::is_random_access; \
+ static_assert (true, "")
+
+
+
/* Base class for sorted iterators. Does not enforce anything.
* Just for class taxonomy and requirements. */
template <typename Iter, typename Item = typename Iter::__item_type__>
diff --git a/src/test-iter.cc b/src/test-iter.cc
index 3fdf4df..2e8c408 100644
--- a/src/test-iter.cc
+++ b/src/test-iter.cc
@@ -109,6 +109,8 @@
test_iterable (v);
hb_set_t st;
test_iterable (st);
+ hb_sorted_array_t<int> sa;
+ test_iterable (sa);
return 0;
}