unique [C++ Reference]
Keywords: stl,algorithm,unique
Date: 2009-10-09T01:13:56-0700

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

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

## unique

Syntax:

        #include <algorithm>
        forward_iterator unique( forward_iterator start, forward_iterator end );
        forward_iterator unique( forward_iterator start, forward_iterator end, BinPred p );

The unique() algorithm removes all consecutive duplicate elements from the range [start,end). If the binary predicate p is given, then it is used to test two elements to see if they are duplicates.

The return value of unique() is an iterator to the end of the modified range.

unique() runs in linear time.

Related Topics: adjacent_find, remove, unique_copy

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