C++ Standard Library set_difference() Sample

Description

set_difference() computes the difference of two sorted sequences of elements, and inserts the result into a container referenced by an output iterator. The difference is defined to be those elements that are in the first sequence but not in the second. Duplicate elements are eliminated on output.

Declaration

	template <class In, class In2, class Out>
	    Out set_difference(In, In, In2, In2, Out);
	template <class In, class In2, class Out, class Cmp>
	    Out set_difference(In, In, In2, In2, Out, Cmp);

Concept

The sample sets up two sorted vectors, and then computes their difference. The results of the computation are inserted into a third vector, using a back_inserter() function. The value 1 is output by the program.

Supported
Supported
Supported