Added BinarySearchIndexByKey().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31491 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
29f659f283
commit
3edae90975
@ -207,6 +207,10 @@ public:
|
||||
int32 BinarySearchIndex(const T &item, CompareFunctionWithState compare,
|
||||
void *state) const;
|
||||
|
||||
template<typename Key>
|
||||
int32 BinarySearchIndexByKey(const Key &key,
|
||||
int (*compare)(const Key *, const T *)) const;
|
||||
|
||||
// Binary insertion - list must be sorted with CompareFunction for
|
||||
// these to work
|
||||
|
||||
@ -693,6 +697,17 @@ BObjectList<T>::BinarySearchIndex(const T &item,
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<typename Key>
|
||||
int32
|
||||
BObjectList<T>::BinarySearchIndexByKey(const Key &key,
|
||||
int (*compare)(const Key *, const T *)) const
|
||||
{
|
||||
return _PointerList_::BinarySearchIndex(&key,
|
||||
(GenericCompareFunction)compare);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
bool
|
||||
BObjectList<T>::BinaryInsert(T *item, CompareFunction func)
|
||||
|
Loading…
Reference in New Issue
Block a user