src/cx/iterator.h

changeset 495
2856c74e18ba
parent 494
6ce8cfa10a96
child 496
1a07e24801a9
     1.1 --- a/src/cx/iterator.h	Sat Jan 22 17:15:14 2022 +0100
     1.2 +++ b/src/cx/iterator.h	Sat Jan 22 18:49:06 2022 +0100
     1.3 @@ -57,16 +57,6 @@
     1.4   */
     1.5  struct cx_iterator_s {
     1.6      /**
     1.7 -     * If the iterator is position-aware, contains the index of the element in the underlying collection.
     1.8 -     * Otherwise, this field is usually uninitialized.
     1.9 -     */
    1.10 -    size_t index;
    1.11 -    /**
    1.12 -     * Internal data.
    1.13 -     */
    1.14 -    void *data;
    1.15 -
    1.16 -    /**
    1.17       * True iff the iterator points to valid data.
    1.18       */
    1.19      bool (*valid)(CxIterator const *) __attribute__ ((__nonnull__));
    1.20 @@ -80,6 +70,29 @@
    1.21       * Advances the iterator.
    1.22       */
    1.23      void (*next)(CxIterator *) __attribute__ ((__nonnull__));
    1.24 +
    1.25 +    /**
    1.26 +     * Handle for the current element, if required.
    1.27 +     */
    1.28 +    void *elem_handle;
    1.29 +
    1.30 +    /**
    1.31 +     * Handle for the source collection, if any.
    1.32 +     */
    1.33 +    void *src_handle;
    1.34 +
    1.35 +    /**
    1.36 +     * If the iterator is position-aware, contains the index of the element in the underlying collection.
    1.37 +     * Otherwise, this field is usually uninitialized.
    1.38 +     */
    1.39 +    size_t index;
    1.40 +
    1.41 +    /**
    1.42 +     * Users may set this to true, if the current element shall be removed from the underlying collection
    1.43 +     * when the iterator advances.
    1.44 +     * Has no effect on iterators that are not based on a collection.
    1.45 +     */
    1.46 +    bool remove;
    1.47  };
    1.48  
    1.49  /**

mercurial