Sequence.insertSorted
glib.sequence_iter.SequenceIter insertSorted(void * data, glib.types.CompareDataFunc cmpFunc)Inserts data into seq using cmp_func to determine the new position. The sequence must already be sorted according to cmp_func; otherwise the new position of data is undefined.
cmp_func is called with two items of the seq, and cmp_data. It should return 0 if the items are equal, a negative value if the first item comes before the second, and a positive value if the second item 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 [glib.sequence.Sequence.sort] or [glib.sequence.Sequence.sortIter].
Parameters
data | the data to insert |
cmpFunc | the function used to compare items in the sequence |
Returns
a #GSequenceIter pointing to the new item.