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