### Method

# GLib Sequence search

since: 2.14

#### Declaration

    GSequenceIter*
    g_sequence_search (
      GSequence* seq,
      gpointer data,
      GCompareDataFunc cmp_func,
      gpointer cmp_data
    )

#### Description

Returns an iterator pointing to the position where `data` would be inserted according to `cmp_func` and `cmp_data`.

`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.

If you are simply searching for an existing element of the sequence, consider using g_sequence_lookup().

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

Available since: 2.14

#### Parameters

`data`

  Type: `gpointer`

  Data for the new item.

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

`cmp_func`

  Type: `GCompareDataFunc`

  The function used to compare items in the sequence.

`cmp_data`

  Type: `gpointer`

  User data passed to `cmp_func`.

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

#### Return value

Type: `GSequenceIter`

An `GSequenceIter` pointing to the position where `data` would have been inserted according to `cmp_func` and `cmp_data`.

The returned data is owned by the instance.