cpp/algorithm/unique

Eliminates all except the first element from every consecutive group of equivalent elements from the range and returns a past-the-end iterator for the new logical end of the range.

Removing is done by shifting the elements in the range in such a way that elements to be erased are overwritten.

@1@ Elements are compared using. The behavior is undefined if it is not an equivalence relation. @3@ Elements are compared using the given binary predicate. The behavior is undefined if it is not an equivalence relation. @2,4@ Same as, but executed according to.

Return value
A to the new end of the range.

Complexity
For nonempty ranges, exactly applications of the corresponding predicate.

Possible implementation
See also the implementations in libstdc++, libc++, and MSVC STL.