PtrArray.findWithEqualFunc

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.

class PtrArray
bool
findWithEqualFunc
(
void* needle
,
GEqualFunc equalFunc
,
out uint index
)

Parameters

needle void*

pointer to look for

equalFunc 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 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