|
|
template <class ForIter, class T> bool binary_search(ForIter start, ForIter end, const T &val); template <class ForIter, class T, class Comp> bool binary_search(ForIter start, ForIter end, const T &val, Comp cmpfn);
The binary_search( ) algorithm performs a binary search on an ordered sequence beginning at start and ending with end for the value specified by val. It returns true if the val is found and false otherwise. The first version compares the elements in the specified sequence for equality. The second version allows you to specify your own comparison function.
|
|