unique_copy [C++ Reference]
Keywords: stl,algorithm,unique_copy
Date: 2009-10-09T01:15:32-0700

[[unique_copy]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- fr
- it
- jp
- pl
- ru
- tr

## unique_copy

Syntax:

        #include <algorithm>
        output_iterator unique_copy( input_iterator start, input_iterator end, output_iterator result );
        output_iterator unique_copy( input_iterator start, input_iterator end, output_iterator result, BinPred p );

The unique_copy() function copies the range [start,end) to result, removing all consecutive duplicate elements. If the binary predicate p is provided, then it is used to test two elements to see if they are duplicates.

The return value of unique_copy() is an iterator to the end of the new range.

unique_copy() runs in linear time.

Related Topics: adjacent_find, remove, unique

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •