59 void *(*current)(
const void *);
64 void *(*current_impl)(
const void *);
92#define CX_ITERATOR_BASE struct cx_iterator_base_s base
160#define cxIteratorValid(iter) (iter).base.valid(&(iter))
171#define cxIteratorCurrent(iter) (iter).base.current(&iter)
178#define cxIteratorNext(iter) (iter).base.next(&iter)
187#define cxIteratorFlagRemoval(iter) (iter).base.remove |= (iter).base.mutating
197#define cxIteratorRef(iter) &((iter).base)
206#define cx_foreach(type, elem, iter) \
207for (type elem; cxIteratorValid(iter) && (elem = (type)cxIteratorCurrent(iter)) != NULL ; cxIteratorNext(iter))
264 bool remove_keeps_order
306 bool remove_keeps_order
Common definitions and feature checks.
#define cx_attr_export
Only used for building Windows DLLs.
Definition common.h:285
#define cx_attr_nodiscard
Warn about discarded return value.
Definition common.h:265
#define CX_ITERATOR_BASE
Declares base attributes for an iterator.
Definition iterator.h:92
CxIterator cxIteratorPtr(const void *array, size_t elem_count)
Creates an iterator for the specified plain pointer array.
CxIterator cxMutIteratorPtr(void *array, size_t elem_count, bool remove_keeps_order)
Creates a mutating iterator for the specified plain pointer array.
CxIterator cxIterator(const void *array, size_t elem_size, size_t elem_count)
Creates an iterator for the specified plain array.
CxIterator cxMutIterator(void *array, size_t elem_size, size_t elem_count, bool remove_keeps_order)
Creates a mutating iterator for the specified plain array.
Common data for all iterators.
Definition iterator.h:48
bool remove
Internal flag for removing the current element when advancing.
Definition iterator.h:79
bool(* valid)(const void *)
True if the iterator points to valid data.
Definition iterator.h:52
bool mutating
Indicates whether this iterator may remove elements.
Definition iterator.h:75
void(* next)(void *)
Advances the iterator.
Definition iterator.h:71
Internal iterator struct - use CxIterator.
Definition iterator.h:97
void * m
Access for mutating iterators.
Definition iterator.h:115
size_t elem_count
May contain the total number of elements, if known.
Definition iterator.h:137
void * elem_handle
Handle for the current element.
Definition iterator.h:106
const void * c
Access for normal iterators.
Definition iterator.h:119
size_t index
If the iterator is position-aware, contains the index of the element in the underlying collection.
Definition iterator.h:126
union cx_iterator_s::@2 src_handle
Handle for the source collection, if any.
size_t elem_size
The size of an individual element.
Definition iterator.h:131