Standard C++ Library Class Reference
 #include <iostream.h>
 int main()
 {
 //Initialize a vector with an array of ints
 int arr[10] = {1,2,3,4,5,6,7,8,9,10};
 vector<int> v(arr, arr+10);
 //Print out elements in original (sorted) order
 cout << "Elements before rotate: " << endl << " ";
 copy(v.begin(),v.end(),ostream_iterator<int>(cout," "));
 cout << endl << endl;
 //Rotate the elements
 rotate(v.begin(), v.begin()+4, v.end());
 //Print out the rotated elements
 cout << "Elements after rotate: " << endl << " ";
 copy(v.begin(),v.end(),ostream_iterator<int>(cout," "));
 cout << endl;
 return 0;
 }
Output :
Elements before rotate:
 1 2 3 4 5 6 7 8 9 10
Elements after rotate:
 5 6 7 8 9 10 1 2 3 4
Warning
If your compiler does not support default template parameters, then you need to always supply
the Allocator template argument. For instance, you will need to write :
vector<int, allocator>
instead of :
vector<int>










