[iter] For ref-qualified variants

This commit is contained in:
Behdad Esfahbod 2019-05-08 09:56:29 -07:00
parent fa576ce187
commit a66598e030
1 changed files with 10 additions and 4 deletions

View File

@ -98,9 +98,11 @@ struct hb_iter_t
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(); }
iter_t& operator -- () & { thiz()->__prev__ (); return *thiz(); }
iter_t operator -- () && { thiz()->__prev__ (); return *thiz(); }
iter_t operator + (unsigned count) const { auto c = thiz()->iter (); c += count; return c; }
@ -111,7 +113,11 @@ 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) && { v = **thiz(); ++*thiz(); return *thiz(); }
template <typename T>
iter_t& operator << (const T v) & { **thiz() = v; ++*thiz(); return *thiz(); }
template <typename T>
iter_t operator << (const T v) && { **thiz() = v; ++*thiz(); return *thiz(); }
protected:
hb_iter_t () {}