[iter] Add unary operator+ that returns a copy

This commit is contained in:
Behdad Esfahbod 2019-01-27 00:49:37 +01:00
parent fbab07f9b3
commit 2f5b1a9104
2 changed files with 2 additions and 1 deletions

View File

@ -69,6 +69,7 @@ struct hb_iter_t
/* Operators. */ /* Operators. */
iter_t iter () const { return *thiz(); } iter_t iter () const { return *thiz(); }
iter_t operator + () const { return *thiz(); }
explicit_operator bool () const { return thiz()->__more__ (); } explicit_operator bool () const { return thiz()->__more__ (); }
unsigned len () const { return thiz()->__len__ (); } unsigned len () const { return thiz()->__len__ (); }
hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); } hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); }

View File

@ -135,7 +135,7 @@ main (int argc, char **argv)
hb_array_t<hb_vector_t<int> > pa; hb_array_t<hb_vector_t<int> > pa;
pa->as_array (); pa->as_array ();
s + s
| hb_map (hb_identity) | hb_map (hb_identity)
| hb_filter () | hb_filter ()
| hb_filter (hb_bool) | hb_filter (hb_bool)