default (1) | template <class InputIterator1, class InputIterator2, class OutputIterator> OutputIterator merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
---|---|
custom (2) | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> OutputIterator merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
[first1,last1)
and [first2,last2)
, into a new range beginning at result with all its elements sorted.operator<
for the first version, and comp for the second. The elements in both ranges shall already be ordered according to this same criterion (operator<
or comp). The resulting range is also sorted according to this.
|
|
[first1,last1)
, which contains all the elements between first1 and last1, including the element pointed by first1 but not the element pointed by last1.[first2,last2)
.bool
. The value returned indicates whether the first argument is considered to go before the second in the specific strict weak ordering it defines.operator<
for (1), and with comp for (2)).
|
|
The resulting vector contains: 5 10 10 15 20 20 25 30 40 50 |
(1+count1-count2)
, where countX is the distance between firstX and lastX: Compares and assigns all elements.[first1,last1)
and [first2,last2)
are accessed.