[iter] Add back operator +
authorBehdad Esfahbod <behdad@behdad.org>
Sun, 30 Dec 2018 07:11:03 +0000 (02:11 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 21 Jan 2019 01:12:12 +0000 (20:12 -0500)
Too ugly to remove..

src/hb-iter.hh
src/test-iter.cc

index 24a7e3b..57f481d 100644 (file)
@@ -75,8 +75,8 @@ struct hb_iter_t
   iter_t& operator ++ () { thiz()->__next__ (); return *thiz(); }
   iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); }
   iter_t& operator -- () { thiz()->__prev__ (); return *thiz(); }
-  //TODO(C++11)iter_t operator + (unsigned count) const { iter_t c (*thiz()); c += count; return c; }
-  //TODO(C++11)friend iter_t operator + (unsigned count, const iter_t &it) { return it + count; }
+  iter_t operator + (unsigned count) const { iter_t c (*thiz()); 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 { iter_t c (*thiz()); c -= count; return c; }
   iter_t operator -- (int) { iter_t c (*thiz()); --*thiz(); return c; }
@@ -103,7 +103,7 @@ struct hb_iter_t
   using Name::operator ++; \
   using Name::operator -=; \
   using Name::operator --; \
-  /*TODO(C++11)using Name::operator +;*/ \
+  using Name::operator +; \
   using Name::operator -; \
   using Name::is_random_access; \
   static_assert (true, "")
index f93c212..b4f056b 100644 (file)
@@ -75,8 +75,8 @@ test_iterator (Iterator it)
     *c;
 
   it += it.len ();
-  //TODO(C++11)it = it + 10;
-  //TODO(C++11)it = 10 + it;
+  it = it + 10;
+  it = 10 + it;
 
   assert (*it == it[0]);