Method

GLibSequenceinsert_sorted_iter

Declaration

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

Description

Like g_sequence_insert_sorted(), 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.

Note that when adding a large amount of data to a GSequence, it is more efficient to do unsorted insertions and then call g_sequence_sort() or g_sequence_sort_iter().

Available since:2.14
This method is not directly available to language bindings.

Parameters

data gpointer
 

Data for the new item.

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

The function used to compare iterators in the sequence.

cmp_data gpointer
 

User data passed to iter_cmp.

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

Return value

Returns: GSequenceIter
 

A GSequenceIter pointing to the new item.

 The data is owned by the instance.