docs/src/features.md

changeset 853
d4baf4dd55c3
parent 834
04c53b3c8378
child 854
fe0d69d72bcd
     1.1 --- a/docs/src/features.md	Thu May 23 18:21:36 2024 +0200
     1.2 +++ b/docs/src/features.md	Thu May 23 19:29:14 2024 +0200
     1.3 @@ -186,15 +186,17 @@
     1.4  Sometimes you only need the `index` (for example when iterating over simple lists), and other times you will need the
     1.5  `slot` and `kv_data` fields (for example when iterating over maps).
     1.6  
     1.7 +If the predefined fields are insufficient for your use case, you can alternatively create your own iterator structure
     1.8 +and place the `CX_ITERATOR_BASE` macro inside.
     1.9 +
    1.10  Usually an iterator is not mutating the collection it is iterating over.
    1.11  In some programming languages it is even disallowed to change the collection while iterating with foreach.
    1.12  But sometimes it is desirable to remove an element from the collection while iterating over it.
    1.13 -This is, what the `CxMutIterator` is for.
    1.14 +For this purpose, most collections allow the creation of a _mutating_ iterator.
    1.15  The only differences are, that the `mutating` flag is `true` and the `src_handle` is not const.
    1.16  On mutating iterators it is allowed to call the `cxFlagForRemoval()` function, which instructs the iterator to remove
    1.17  the current element from the collection on the next call to `cxIteratorNext()` and clear the flag afterward.
    1.18 -If you are implementing your own iterator, it is up to you to implement this behavior in your `next` method, or
    1.19 -make the implementation of the `flag_removal` method always return `false`.
    1.20 +If you are implementing your own iterator, it is up to you to implement this behavior.
    1.21  
    1.22  ## Collection
    1.23  

mercurial