copy. McGraw-Hill The Complete Reference Fourth Edition
Anúncio
Anúncio
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
841 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
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.
copy
template <class InIter, class OutIter>
OutIter copy(InIter start, InIter end, OutIter result);
The copy( ) algorithm copies a sequence beginning at start and ending with end, putting the result into the sequence pointed to by result. It returns an iterator to the end of the resulting sequence. The range to be copied must not overlap with result.
copy_backward
template <class BiIter1, class BiIter2>
BiIter2 copy_backward(BiIter1 start, BiIter1 end, BiIter2 result);
The copy_backward( ) algorithm is the same as copy( ) except that it moves the elements from the end of the sequence first.
count
template <class InIter, class T> ptrdiff_t count(InIter start, InIter end, const T &val);
The count( ) algorithm returns the number of elements in the sequence beginning at
start and ending at end that match val.
Download
Anúncio