Method

GLibSequencelookup_iter

since: 2.28

Declaration

GSequenceIter*
g_sequence_lookup_iter (
  GSequence* seq,
  gpointer data,
  GSequenceIterCompareFunc iter_cmp,
  gpointer cmp_data
)

Description

Like g_sequence_lookup(), but uses a GSequenceIterCompareFunc instead of a GCompareDataFunc as the compare function.

iter_cmp is called with two iterators pointing into seq. It should return 0 if the iterators are equal, a negative value if the first iterator comes before the second, and a positive value if the second iterator comes before the first.

This function will fail if the data contained in the sequence is unsorted.

Available since: 2.28

Parameters

data

Type: gpointer

Data to look up.

The argument can be NULL.
The data is owned by the caller of the function.
iter_cmp

Type: GSequenceIterCompareFunc

The function used to compare iterators in the sequence.

cmp_data

Type: gpointer

User data passed to iter_cmp.

The argument can be NULL.
The data is owned by the caller of the function.

Return value

Type: GSequenceIter

An GSequenceIter pointing to the position of the first item found equal to data according to iter_cmp and cmp_data, or NULL if no such item exists.

The data is owned by the instance.
The return value can be NULL.