code:
// rotate_copy algorithm example#include// cout#include // rotate_copy#include // vectorusing namespace std;int main () { int myints[] = { 10,20,30,40,50,60,70}; vector myvector(7); rotate_copy(myints,myints+3,myints+7,myvector.begin()); // print out content: cout << "myvector contains:"; for (vector ::iterator it=myvector.begin(); it!=myvector.end(); ++it) cout << ' ' << *it; cout << '\n'; return 0;}
输出
myvector contains: 40 50 60 70 10 20 30