An iterator that works on contiguous arrays.
ITERATOR.
- Author
- Leonardo Vencovsky
- Version
- 0.0.1
The implementation of the array iterator can be tuned depending on the underlying data structure. By default, this is an iterator that starts at the index 0 of an array and goes up to count. By specifying extra options, you can change the behaviour of the iterator. Only one of them can be defined.
Options
CIRCULAR: if defined, the pointer wraps around the array's capacity. The _start and _end functions now require an extra parameter to specify at which index the iterator starts or ends.
SPARSE(item): a function-like macro. If defined, the array contains "holes". This macro needs to return a boolean value that checks if the passed item is a hole or not.
Required Macros
V: Type name of the array (e.g. V *buffer).
SNAME: Prefix of all declared structs (e.g. struct SNAME, struct SNAME_vtabv, etc.).
PFX: Prefix of all functions, including implementation detail ones.
TAG: A unique integer tag that identifies this data structure.
Internally used macros
IT_ prefix macros: used by other data structures. Should not be used directly.
EMBEDDED: used by other data structures to automatically implement an iterator. When this is enabled, it changes the input macros and prefixes them all with "IT_".
Usage
{
}
struct dynamic_array_iter da_iter_start(struct dynamic_array *self)
Definition dynamic_array.h:858
_Bool da_iter_at_end(struct dynamic_array_iter *self)
Definition dynamic_array.h:771
void da_iter_next(struct dynamic_array_iter *self)
Definition dynamic_array.h:795
TVal da_iter_value(struct dynamic_array_iter *self)
Definition dynamic_array.h:853
- Author
- Leonardo Vencovsky
An iterator that works on contiguous arrays.
- Version
- 0.0.1
The implementation of the array iterator can be tuned depending on the underlying data structure. By default, this is an iterator that starts at the index 0 of an array and goes up to count. By specifying extra options, you can change the behaviour of the iterator. Only one of them can be defined.
Options
CIRCULAR: if defined, the pointer wraps around the array's capacity. The _start and _end functions now require an extra parameter to specify at which index the iterator starts or ends.
SPARSE(item): a function-like macro. If defined, the array contains "holes". This macro needs to return a boolean value that checks if the passed item is a hole or not.
Required Macros
V: Type name of the array (e.g. V *buffer).
SNAME: Prefix of all declared structs (e.g. struct SNAME, struct SNAME_vtabv, etc.).
PFX: Prefix of all functions, including implementation detail ones.
TAG: A unique integer tag that identifies this data structure.
Internally used macros
IT_ prefix macros: used by other data structures. Should not be used directly.
EMBEDDED: used by other data structures to automatically implement an iterator. When this is enabled, it changes the input macros and prefixes them all with "IT_".
Usage
- Author
- Leonardo Vencovsky
An iterator that works on contiguous arrays.
- Version
- 0.0.1
The implementation of the array iterator can be tuned depending on the underlying data structure. By default, this is an iterator that starts at the index 0 of an array and goes up to count. By specifying extra options, you can change the behaviour of the iterator. Only one of them can be defined.
Options
CIRCULAR: if defined, the pointer wraps around the array's capacity. The _start and _end functions now require an extra parameter to specify at which index the iterator starts or ends.
SPARSE(item): a function-like macro. If defined, the array contains "holes". This macro needs to return a boolean value that checks if the passed item is a hole or not.
Required Macros
V: Type name of the array (e.g. V *buffer).
SNAME: Prefix of all declared structs (e.g. struct SNAME, struct SNAME_vtabv, etc.).
PFX: Prefix of all functions, including implementation detail ones.
TAG: A unique integer tag that identifies this data structure.
Internally used macros
IT_ prefix macros: used by other data structures. Should not be used directly.
EMBEDDED: used by other data structures to automatically implement an iterator. When this is enabled, it changes the input macros and prefixes them all with "IT_".
Usage