[iter] Fix operator->
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 8 Jan 2019 02:38:49 +0000 (21:38 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 21 Jan 2019 01:12:12 +0000 (20:12 -0500)
src/hb-iter.hh
src/test-iter.cc

index beb7c93..c91740f 100644 (file)
@@ -69,7 +69,8 @@ struct hb_iter_t
   iter_t iter () const { return *thiz(); }
   explicit_operator bool () const { return thiz()->__more__ (); }
   unsigned len () const { return thiz()->__len__ (); }
-  hb_remove_reference (item_t)* operator -> () const { return hb_addressof (*thiz()); }
+  template <typename U = item_t, hb_enable_if (hb_is_reference (U))>
+  hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); }
   item_t operator * () const { return thiz()->__item__ (); }
   item_t operator [] (unsigned i) const { return thiz()->__item_at__ (i); }
   iter_t& operator += (unsigned count) { thiz()->__forward__ (count); return *thiz(); }
index fbe0708..57568d7 100644 (file)
@@ -121,5 +121,8 @@ main (int argc, char **argv)
   test_iterable<hb_set_t> ();
   test_iterable<OT::Coverage> ();
 
+  hb_array_t<hb_vector_t<int> > pa;
+  pa->as_array ();
+
   return 0;
 }