void
qarray_iter (qarray *a, const size_t startat, const size_t stopat, qthread_f
func);
void
qarray_iter_loop (qarray *a, const size_t startat, const size_t stopat,
qa_loop_f func, void *arg);
void
qarray_iter_loop_nb (qarray *a, const size_t startat, const size_t stopat,
qa_loop_f func, void *arg, aligned_t *arg);
void
qarray_iter_constloop (qarray *a, const size_t startat, const size_t stopat,
qa_loop_f func, void *arg);
void
qarray_iter_loopaccum (qarray *a, const size_t startat, const size_t stopat,
qa_loopr_f func, void *arg, void *ret, const size_t retsize, qt_accum_f
acc);
void func (void *arg);
The arg argument to the func function is a pointer to an array element.
The qarray_iter_loop(),qarray_iter_loop_nb(),qarray_iter_constloop(), and qarray_iter_loopaccum() functions are more powerful iteration functions. They are largely identical, with the following distinctions: the qarray_iter_constloop() function forbids modifying the input qarray, and the qarray_iter_loopaccum() function requires an accumulator function, acc, and allows the calculation of an accumulated value similar to qt_loopaccum_balance(). Both functions iterate over a range of values within the qarray, which is defined by the startat and stopat arguments. The func argument is expected to be a function of the following form:
void func (const size_t startat, const size_t stopat, qarray *array, void *arg)
{size_t i;}
for (i = startat; i < stopat; i ++) {/* do work */}
The function func is given a sub-range of the qarray to iterate over. The arg argument passed to the func function is the same argument as is passed to the qarray_iter_loop() argument. The qarray_iter_loop_nb() variant allows the iterations to occur in the background while allowing the calling thread to continue execution.