[iter] Add operator>> and operator<<
This commit is contained in:
parent
8bd96be994
commit
57795bc8dd
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue