Standard C++ Library Class Reference

v2.end());
//
// Output result.
//
cout << endl << "A partial_sort_copy of the last ten elements
gives: "
<< endl << " ";
copy(v2.begin(), v2.end(), ostream_iterator<int>(cout," "));
cout << endl;
return 0;
}
Output :
For the vector: 17 3 5 -4 1 12 -10 -1 14 7 -6 8 15 -11 2 -2 18 4 -3 0
A partial_sort of seven elements gives:
-11 -10 -6 -4 -3 -2 -1 17 14 12 7 8 15 5 3 2 18 4 1 0
A partial_sort_copy of the last ten elements gives:
0 1 2 3 4 5 7 8 15 18
Warning
If your compiler does not support default template parameters, then you need to always provide the
Allocator template argument. For instance, you will need to write :
vector<int, allocator>
instead of :
vector<int>
See Also
sort, stable_sort, partial_sort_copy