[iter] For ref-qualified variants
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 8 May 2019 16:56:29 +0000 (09:56 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 8 May 2019 17:03:10 +0000 (10:03 -0700)
src/hb-iter.hh

index a339013..dc47389 100644 (file)
@@ -97,10 +97,12 @@ struct hb_iter_t
   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 += (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 -= (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; }
@@ -109,9 +111,13 @@ struct hb_iter_t
   iter_t operator - (unsigned count) const { auto c = thiz()->iter (); c -= count; return c; }
   iter_t operator -- (int) { iter_t c (*thiz()); --*thiz(); return c; }
   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>
-  iter_t& operator << (const T v) & { **thiz() = v; ++*thiz(); return *thiz(); }
+  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 () {}