|
inplace_mergefunction template
<algorithm> template <class BidirectionalIterator> void inplace_merge ( BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last ); template <class BidirectionalIterator, class Compare> void inplace_merge ( BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp ); Merge consecutive sorted ranges Merges two consecutive sorted ranges: [first,middle) and [middle,last), putting the result into the combined sorted range [first,last). The comparison for sorting uses either operator< for the first version, or comp for the second.For the function to yield the expected result, the elements of each of both ranges shall already be ordered (independently for each range) according to the same strict weak ordering criterion used by this function (operator< or comp). The resulting range is also sorted according to it. Parameters
Return valuenoneExample
Output:
ComplexityLinear in comparisons (N-1) if an internal buffer was used, NlogN otherwise (where N is the number elements in the range [first,last)).See also
|