Added BinarySearchIndexByKey().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31491 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -207,6 +207,10 @@ public:
|
|||||||
int32 BinarySearchIndex(const T &item, CompareFunctionWithState compare,
|
int32 BinarySearchIndex(const T &item, CompareFunctionWithState compare,
|
||||||
void *state) const;
|
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
|
// Binary insertion - list must be sorted with CompareFunction for
|
||||||
// these to work
|
// 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>
|
template<class T>
|
||||||
bool
|
bool
|
||||||
BObjectList<T>::BinaryInsert(T *item, CompareFunction func)
|
BObjectList<T>::BinaryInsert(T *item, CompareFunction func)
|
||||||
|
|||||||
Reference in New Issue
Block a user