// A good generic utility candidate. Assumes sorted arrays. static gint g_ptr_array_cmp(GPtrArray* array0, GPtrArray* array1, GCompareFunc compareFunc) { int i; int len = MIN(array0->len, array1->len); for (i=0; i<len; i++) { int res = (*compareFunc)(array0->pdata + i, array1->pdata + i); if (!res) return res; } return cmpInt(array0->len, array1->len); }
IntMap::const_iterator utl::findValue (const IntMap& iMap, int iVal) { return std::find_if(iMap.begin(),iMap.end(),cmpInt(iVal)); }