src/cx/iterator.h

changeset 829
7d4e31d295af
parent 759
475335643af4
     1.1 --- a/src/cx/iterator.h	Sat Feb 17 20:22:13 2024 +0100
     1.2 +++ b/src/cx/iterator.h	Sat Feb 17 20:51:27 2024 +0100
     1.3 @@ -71,14 +71,6 @@
     1.4      void (*next)(void *);
     1.5  
     1.6      /**
     1.7 -     * Flag current element for removal, if possible.
     1.8 -     *
     1.9 -     * When valid returns false, the behavior of this function is undefined.
    1.10 -     */
    1.11 -    __attribute__ ((__nonnull__))
    1.12 -    bool (*flag_removal)(void *);
    1.13 -
    1.14 -    /**
    1.15       * Indicates whether this iterator may remove elements.
    1.16       */
    1.17      bool mutating;
    1.18 @@ -243,12 +235,11 @@
    1.19  #define cxIteratorNext(iter) (iter).base.next(&iter)
    1.20  
    1.21  /**
    1.22 - * Flags the current element for removal.
    1.23 + * Flags the current element for removal, if this iterator is mutating.
    1.24   *
    1.25   * @param iter the iterator
    1.26 - * @return false if this iterator cannot remove the element
    1.27   */
    1.28 -#define cxIteratorFlagRemoval(iter) (iter).base.flag_removal(&iter)
    1.29 +#define cxIteratorFlagRemoval(iter) (iter).base.remove |= (iter).base.mutating
    1.30  
    1.31  /**
    1.32   * Loops over an iterator.

mercurial