Added BinarySearchIndex().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31186 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4ae1f25b97
commit
6cd189c997
@ -203,6 +203,10 @@ public:
|
||||
T *BinarySearchByKey(const Key &key,
|
||||
int (*compare)(const Key *, const T *, void *), void *state) const;
|
||||
|
||||
int32 BinarySearchIndex(const T &item, CompareFunction compare) const;
|
||||
int32 BinarySearchIndex(const T &item, CompareFunctionWithState compare,
|
||||
void *state) const;
|
||||
|
||||
// Binary insertion - list must be sorted with CompareFunction for
|
||||
// these to work
|
||||
|
||||
@ -670,6 +674,25 @@ BObjectList<T>::BinarySearchByKey(const Key &key,
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
int32
|
||||
BObjectList<T>::BinarySearchIndex(const T &item, CompareFunction compare) const
|
||||
{
|
||||
return _PointerList_::BinarySearchIndex(&item,
|
||||
(GenericCompareFunction)compare);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
int32
|
||||
BObjectList<T>::BinarySearchIndex(const T &item,
|
||||
CompareFunctionWithState compare, void *state) const
|
||||
{
|
||||
return _PointerList_::BinarySearchIndex(&item,
|
||||
(GenericCompareFunctionWithState)compare, state);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
bool
|
||||
BObjectList<T>::BinaryInsert(T *item, CompareFunction func)
|
||||
|
Loading…
Reference in New Issue
Block a user