GLib.PtrArray.find_with_equal_func
Description: Reference for GLib.PtrArray.find_with_equal_func

### Function

# GLib PtrArrayfind_with_equal_func

since: 2.54

#### Declaration [src]

    gboolean
    g_ptr_array_find_with_equal_func (
      GPtrArray* haystack,
      gconstpointer needle,
      GEqualFunc equal_func,
      guint* index_
    )

#### Description [src]

Checks whether `needle` exists in `haystack`, using the given `equal_func`. If the element is found, true is returned and the element’s index is returned in `index_` (if non-`NULL`). Otherwise, false is returned and `index_` is undefined. If `needle` exists multiple times in `haystack`, the index of the first instance is returned.

`equal_func` is called with the element from the array as its first parameter, and `needle` as its second parameter. If `equal_func` is `NULL`, pointer equality is used.

Available since: 2.54

This function is not directly available to language bindings.

#### Parameters

`haystack`

  Type: An array of `gpointer`

  The pointer array to be searched.

  The data is owned by the caller of the function.

`needle`

  Type: `gconstpointer`

  The pointer to look for.

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

`equal_func`

  Type: `GEqualFunc`

  The function to call for each element, which should return true when the desired element is found; or `NULL` to use pointer equality.

`index_`

  Type: `guint*`

  The return location for the index of the element, if found.

  The argument will be set by the function.
  The argument can be `NULL`.

#### Return value

Type: `gboolean`

True if `needle` is one of the elements of `haystack`; false otherwise.