diff -r 88fa3381206d -r 7d4e31d295af src/cx/iterator.h --- a/src/cx/iterator.h Sat Feb 17 20:22:13 2024 +0100 +++ b/src/cx/iterator.h Sat Feb 17 20:51:27 2024 +0100 @@ -71,14 +71,6 @@ void (*next)(void *); /** - * Flag current element for removal, if possible. - * - * When valid returns false, the behavior of this function is undefined. - */ - __attribute__ ((__nonnull__)) - bool (*flag_removal)(void *); - - /** * Indicates whether this iterator may remove elements. */ bool mutating; @@ -243,12 +235,11 @@ #define cxIteratorNext(iter) (iter).base.next(&iter) /** - * Flags the current element for removal. + * Flags the current element for removal, if this iterator is mutating. * * @param iter the iterator - * @return false if this iterator cannot remove the element */ -#define cxIteratorFlagRemoval(iter) (iter).base.flag_removal(&iter) +#define cxIteratorFlagRemoval(iter) (iter).base.remove |= (iter).base.mutating /** * Loops over an iterator.