Iterator Functions

Eina provides a set of iterator functions to manipulate data types such as arrays.

These functions allow access to container elements in a generic way, without knowing which container is used (similar to iterators in the C++ Standard Template Library). Iterators only allow sequential access : that is to say from one element to the next. Eina also provides accessor functions for random access.

Getting an iterator to access elements of a given container is done through the functions of that particular container. There is no function to create a generic iterator, as iterators absolutely depend on the container. All iterators regardless of the container type can be deleted with the function : eina_iterator_free().

Use the eina_iterator_next() function to obtain the data and start iterating. To call a function on every single element of a container use the function eina_iterator_foreach().

In addition to iterator functions each data type also owns a set of macros that provide the iterators, such as FOREACH or REVERSE_FOREACH.

Further Reading

Iterator Functions API
A reference for the Iterator API.
Eina Iterator Example
An example use of the Iterator API.