# HG changeset patch # User Mike Becker # Date 1760982258 -7200 # Node ID fb82e7a922589c2631d9dbbd64e37685961933c3 # Parent 1ec36e652e57285239ebc8a8d3d29c78a9b7370d add possibility to wrap valid function of an iterator (just for the sake of completeness) diff -r 1ec36e652e57 -r fb82e7a92258 docs/Writerside/topics/iterator.h.md --- a/docs/Writerside/topics/iterator.h.md Sun Oct 19 21:18:17 2025 +0200 +++ b/docs/Writerside/topics/iterator.h.md Mon Oct 20 19:44:18 2025 +0200 @@ -119,6 +119,7 @@ ```C struct cx_iterator_base_s { bool (*valid)(const void *); + bool (*valid_impl)(const void *); void *(*current)(const void *); void (*next)(void *); void *(*current_impl)(const void *); @@ -138,7 +139,7 @@ When an iterator is created, the `allow_remove` field is set to indicate if removal of elements is supported. The `remove` field is set to indicate if the current element should be removed on the next call to `next()` (see `cxIteratorFlagRemoval()`). -Iterators may be wrapped in which case the original implementation can be stored in `current_impl` and `next_impl`. +Iterators may be wrapped in which case the original implementation can be stored in the `*_impl` function pointers. They can then be called by a wrapper implementation pointed to by `current` and `next`, respectively. This can be useful when you want to support the `store_pointer` field of the [](collection.h.md) API. diff -r 1ec36e652e57 -r fb82e7a92258 src/cx/iterator.h --- a/src/cx/iterator.h Sun Oct 19 21:18:17 2025 +0200 +++ b/src/cx/iterator.h Mon Oct 20 19:44:18 2025 +0200 @@ -50,7 +50,10 @@ * True if the iterator points to valid data. */ bool (*valid)(const void *); - + /** + * Original implementation in case the function needs to be wrapped. + */ + bool (*valid_impl)(const void *); /** * Returns a pointer to the current element. *