unique

Syntax:

    #include <algorithm>
    iterator unique( iterator start, iterator end );
    iterator unique( iterator start, 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