[iter] Add operator>> and operator<<

This commit is contained in:
Behdad Esfahbod committed 2019-01-28 16:23:12 -05:00
1 parent 8bd96be994
commit 57795bc8dd
2 files changed
+8

No files matched your search

+4
View File
@@ -84,6 +84,10 @@ struct hb_iter_t
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 <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(); }
protected:
hb_iter_t () {}
+4
View File
@@ -149,5 +149,9 @@ main (int argc, char **argv)
| hb_filter (hb_bool, hb_identity)
;
t << 1;
long vl;
s >> vl;
return 0;
}