C++ Standard Library inplace_merge() Sample

Description

inplace_merge() merges two sorted subsequences of a sequence into one sorted sequence.

Declaration

	template <class Bi>
	    void inplace_merge(Bi, Bi, Bi);
	template <class Bi, class Cmp>
	    void inplace_merge(Bi, Bi, Bi, Cmp);

Concept

The example program sets up a vector, that contains two sorted sequences within it. These sequences are sorted according to absolute magnitude. The sequences are merged, using a comparison function. Output of the program is:

	-5
	8
	-13
	19
	-29
	37

Special Notes:

For elements that compare equal, those from the first range will precede those from the second, in the merged sequence.

Supported
Supported
Supported