From c09d6c58e99dba50f29a569e4c53916b5b507ef1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 7 May 2019 14:09:00 -0700 Subject: [PATCH] [iter] Require lvalue in operators that return reference --- src/hb-iter.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 63a178a..dc57e2b 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -97,21 +97,21 @@ 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 ++ () { thiz()->__next__ (); return *thiz(); } - iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); } - iter_t& operator -- () { thiz()->__prev__ (); 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 -- () & { 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; } friend iter_t operator + (unsigned count, const iter_t &it) { return it + count; } iter_t operator ++ (int) { iter_t c (*thiz()); ++*thiz(); return c; } 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 - iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); } + 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(); } + iter_t& operator << (const T v) & { **thiz() = v; ++*thiz(); return *thiz(); } protected: hb_iter_t () {} -- 2.7.4