<t>With the least function calls, you should do this:using namespace std;vector<int> test3(test1.size()+test2.size());merge(test1.begin(), test1.end(), test2.begin(), test2.end(), test3.begin());// As the test1 and test2 are already sorted, so test3 is also sorted by "<".vector<int>::iterator end = ...