swap_ranges. McGraw-Hill The Complete Reference Fourth Edition
Mainos
Mainos
858
C + + : T h e C o m p l e t e R e f e r e n c e
swap_ranges
template <class ForIter1, class ForIter2>
ForIter2 swap_ranges(ForIter1 start1, ForIter1 end1,
ForIter2 start2);
The swap_ranges( ) algorithm exchanges elements in the range specified by start1 and end1 with elements in the sequence beginning at start2. It returns an iterator to the end of the sequence specified by start2.
transform
template <class InIter, class OutIter, class Func>
OutIter transform(InIter start, InIter end,
OutIter result, Func unaryfunc); template <class InIter1, class InIter2, class OutIter, class Func>
OutIter transform(InIter1 start1, InIter1 end1,
InIter2 start2, OutIter result,
Func binaryfunc);
The transform( ) algorithm applies a function to a range of elements and stores the outcome in result. In the first form, the range is specified by start and end. The function to be applied is specified by unaryfunc. This function receives the value of an element in its parameter and it must return its transformation.
In the second form, the transformation is applied using a binary operator function that receives the value of an element from the sequence to be transformed in its first parameter and an element from the second sequence as its second parameter.
Both versions return an iterator to the end of the resulting sequence.
unique and unique_copy
template <class ForIter>
ForIter unique(ForIter start, ForIter end); template <class ForIter, class BinPred>
ForIter unique(ForIter start, ForIter end, BinPred pfn); template <class ForIter, class OutIter>
OutIter unique_copy(ForIter start, ForIter end, OutIter result); template <class ForIter, class OutIter, class BinPred>
OutIter unique_copy(ForIter start, ForIter end, OutIter result,
BinPred pfn);
Lataa
Mainos