Hello, According to me the rotate_copy() function can be used in the C++ language to rotate the elements that can be available in the given specified range. The behavior of the rotate_copy() function template can be similar to the following as :
Code:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int myints[] = {10,20,30,40,50,60,70};
vector<int> mvctr;
vector<int>::iterator it;
mvctr.resize(7);
rotate_copy(myints,myints+3,myints+7,mvctr.begin());
cout << "mvctr contains:";
return 0;
}
Output:
Code:
mvctr contains: 40 50 60 70 10 20 30
Bookmarks