merge - a function that merges two sorted arrays, namely, in linear time it gets a sorted array, which consists of the elements of the first and second array.
It takes 5 arguments: two bounds for each array and the left bound of the destination (where the elements of the resulting array will be placed).
More details can be found in the documentation.
Examples:
// source arrays must be sorted
vector a = { 1, 3, 5, 7 };
vector b = { 2, 4, 6 };
// need destination to be large enough
vector c(7);
merge(a.begin(), a.end(), b.begin(), b.end(), c.begin());
// c = [1, 2, 3, 4, 5, 6, 7]
// elements can be repeated
a = {1, 2, 4, 4};
b = { 2, 3, 3, 3, 4, 4 };
c.resize(10);
merge(a.begin(), a.end(), b.begin(), b.end(), c.begin());
// c = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
This function is very useful in the context of merge sort.