提交 57795bc8 编写于 作者: B Behdad Esfahbod

[iter] Add operator>> and operator<<

上级 8bd96be9
......@@ -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 () {}
......
......@@ -149,5 +149,9 @@ main (int argc, char **argv)
| hb_filter (hb_bool, hb_identity)
;
t << 1;
long vl;
s >> vl;
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册