From 78fc43f2930064cd6cf4229c1e4cb76edb8ed7f6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 31 Mar 2019 19:17:07 -0700 Subject: [PATCH] [iter] Fix up build, ouch Yeah, some things not very clear... --- src/hb-iter.hh | 8 ++++++-- src/test-iter.cc | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 18b9c4a..b212aa3 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -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 iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); } template + iter_t& operator >> (T &v) const { v = **thiz(); ++*thiz(); return *thiz(); } + template iter_t& operator << (const T v) { **thiz() = v; ++*thiz(); return *thiz(); } protected: @@ -587,9 +591,9 @@ hb_fill (C& c, const V &v) template 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); } diff --git a/src/test-iter.cc b/src/test-iter.cc index bc45488..205fd33 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -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; -- 2.7.4