upper_bound. McGraw-Hill The Complete Reference Fourth Edition
โฆษณา
โฆษณา
C h a p t e r 3 4 : T h e S T L A l g o r i t h m s
859
The unique( ) algorithm eliminates duplicate elements from the specified range. The second form allows you to specify a binary predicate that determines when one element is equal to another. unique( ) returns an iterator to the end of the range.
The unique_copy( ) algorithm copies the range specified by start1 and end1, eliminating duplicate elements in the process. The outcome is put into result. The second form allows you to specify a binary predicate that determines when one element is equal to another. unique_copy( ) returns an iterator to the end of the range.
upper_bound
template <class ForIter, class T>
ForIter upper_bound(ForIter start, ForIter end, const T &val); template <class ForIter, class T, class Comp>
ForIter upper_bound(ForIter start, ForIter end, const T &val,
Comp cmpfn);
The upper_bound( ) algorithm finds the last point in the sequence defined by start and end that is not greater than val. It returns an iterator to this point.
The second form allows you to specify a comparison function that determines when one element is less than another.
This page intentionally left blank
Chapter 35
STL Iterators,
Allocators, and
Function Objects
861
Copyright © 2003 by The McGraw-Hill Companies. Click here for terms of use.
ดาวน์โหลด
โฆษณา