C++ Standard Library unique() Sample

Description

unique() eliminates duplicate adjacent elements, typically from in a sorted sequence. unique() doesn't actually delete elements, but moves unique elements to the head of the sequence, and returns an iterator to the end of the set of unique elements.

Declaration

	template <class For>
	    For unique(For, For);
	template <class For, class BinPred>
	    For unique(For, For, BinPred);

Concept

The sample program displays the unique elements found in a list of integers. The unique elements are moved to the front of the sequence, with an iterator returned that references the end of the unique elements.

Supported
Supported
Supported