PtrArray.find

Checks whether @needle exists in @haystack. 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.

This does pointer comparisons only. If you want to use more complex equality checks, such as string comparisons, use g_ptr_array_find_with_equal_func().

class PtrArray
bool
find
(
void* needle
,
out uint index
)

Parameters

needle void*

pointer to look for

index uint

return location for the index of the element, if found

Return Value

Type: bool

%TRUE if @needle is one of the elements of @haystack

Meta

Since

2.54