[iter] Fix up build, ouch
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 1 Apr 2019 02:17:07 +0000 (19:17 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 1 Apr 2019 02:17:07 +0000 (19:17 -0700)
Yeah, some things not very clear...

src/hb-iter.hh
src/test-iter.cc

index 18b9c4a..b212aa3 100644 (file)
@@ -77,7 +77,9 @@ struct hb_iter_t
            hb_enable_if (hb_is_reference (T))>
   hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); }
   item_t operator * () const { return thiz()->__item__ (); }
+  item_t operator * () { return thiz()->__item__ (); }
   item_t operator [] (unsigned i) const { return thiz()->__item_at__ (i); }
+  item_t operator [] (unsigned i) { return thiz()->__item_at__ (i); }
   iter_t& operator += (unsigned count) { thiz()->__forward__ (count); return *thiz(); }
   iter_t& operator ++ () { thiz()->__next__ (); return *thiz(); }
   iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); }
@@ -90,6 +92,8 @@ struct hb_iter_t
   template <typename T>
   iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); }
   template <typename T>
+  iter_t& operator >> (T &v) const { v = **thiz(); ++*thiz(); return *thiz(); }
+  template <typename T>
   iter_t& operator << (const T v) { **thiz() = v; ++*thiz(); return *thiz(); }
 
   protected:
@@ -587,9 +591,9 @@ hb_fill (C& c, const V &v)
 
 template <typename S, typename D>
 inline void
-hb_copy (D&& id, S&& is)
+hb_copy (S&& is, D&& id)
 {
-  hb_iter (id) | hb_sink (is);
+  hb_iter (is) | hb_sink (id);
 }
 
 
index bc45488..205fd33 100644 (file)
@@ -120,8 +120,8 @@ main (int argc, char **argv)
   hb_iter (src, 2);
 
   hb_fill (t, 42);
-  hb_copy (t, s);
// hb_copy (t, a.iter ());
+  hb_copy (s, t);
 hb_copy (a.iter (), t);
 
   test_iterable (v);
   hb_set_t st;