Chapter 17: The C String, Exception, Complex, and Pair Classes

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); 

The unique( ) algorithm eliminates consecutive, 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 start and end, eliminating consecutive 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.




C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net