stl:list:unique

C++ Reference

unique

Syntax:

    #include <list>
    void unique();
    void unique( BinPred pr );

The function unique() removes all consecutive duplicate elements from the list.

Note that only consecutive duplicates are removed, which may require that you sort() the list first.

Equality is tested using the == operator, unless pr is specified as a replacement. The ordering of the elements in a list should not change after a call to unique().

unique() runs in linear time.

Related Topics: List operators, remove, remove_if