diff -r 6ce8cfa10a96 -r 2856c74e18ba src/cx/iterator.h --- a/src/cx/iterator.h Sat Jan 22 17:15:14 2022 +0100 +++ b/src/cx/iterator.h Sat Jan 22 18:49:06 2022 +0100 @@ -57,16 +57,6 @@ */ struct cx_iterator_s { /** - * If the iterator is position-aware, contains the index of the element in the underlying collection. - * Otherwise, this field is usually uninitialized. - */ - size_t index; - /** - * Internal data. - */ - void *data; - - /** * True iff the iterator points to valid data. */ bool (*valid)(CxIterator const *) __attribute__ ((__nonnull__)); @@ -80,6 +70,29 @@ * Advances the iterator. */ void (*next)(CxIterator *) __attribute__ ((__nonnull__)); + + /** + * Handle for the current element, if required. + */ + void *elem_handle; + + /** + * Handle for the source collection, if any. + */ + void *src_handle; + + /** + * If the iterator is position-aware, contains the index of the element in the underlying collection. + * Otherwise, this field is usually uninitialized. + */ + size_t index; + + /** + * Users may set this to true, if the current element shall be removed from the underlying collection + * when the iterator advances. + * Has no effect on iterators that are not based on a collection. + */ + bool remove; }; /**