[iter] Fix up build, ouch

Yeah, some things not very clear...
This commit is contained in:
Behdad Esfahbod 2019-03-31 19:17:07 -07:00
parent e5d6fe9782
commit 78fc43f293
2 changed files with 8 additions and 4 deletions

View File

@ -77,7 +77,9 @@ struct hb_iter_t
hb_enable_if (hb_is_reference (T))> hb_enable_if (hb_is_reference (T))>
hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); } hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); }
item_t operator * () const { return thiz()->__item__ (); } 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) 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 += (unsigned count) { thiz()->__forward__ (count); return *thiz(); }
iter_t& operator ++ () { thiz()->__next__ (); return *thiz(); } iter_t& operator ++ () { thiz()->__next__ (); return *thiz(); }
iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); } iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); }
@ -90,6 +92,8 @@ struct hb_iter_t
template <typename T> template <typename T>
iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); } iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); }
template <typename T> 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(); } iter_t& operator << (const T v) { **thiz() = v; ++*thiz(); return *thiz(); }
protected: protected:
@ -587,9 +591,9 @@ hb_fill (C& c, const V &v)
template <typename S, typename D> template <typename S, typename D>
inline void 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);
} }

View File

@ -120,8 +120,8 @@ main (int argc, char **argv)
hb_iter (src, 2); hb_iter (src, 2);
hb_fill (t, 42); hb_fill (t, 42);
hb_copy (t, s); hb_copy (s, t);
// hb_copy (t, a.iter ()); hb_copy (a.iter (), t);
test_iterable (v); test_iterable (v);
hb_set_t st; hb_set_t st;