Function darray_idx_query

Function Documentation

int darray_idx_query(const struct darray *arr, const void *e)

Find the index of an element.

Find the first occurence of the element in the darray which is is equal to e. A recursive implementation of binary search will be used if the darray is sorted, linear scan otherwise. This function can only be called if darray::cmpe was non-NULL during initialization.

Parameters:
  • arr – The darray handle

  • e – To be filled with the served element

Returns:

The index, or -1 if not found