#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
using namespace std;
int main()
{
vector<int> vec1;
deque<int> deq1;
for (int k=0;k<10;k++)
{
vec1.push_back(k);
}
for (int k=10;k<23;k++)
{
deq1.push_back(k);
}
for (auto vec_iter1 = vec1.begin();vec_iter1 != vec1.end();++vec_iter1)
{
cout << *vec_iter1 << " ";
}
cout << endl;
cout << "------------------------------------------------------------" << endl;
for (auto vec_iter1 = deq1.begin(); vec_iter1 != deq1.end(); ++vec_iter1)
{
cout << *vec_iter1 << " ";
}
cout << endl;
cout << "------------------------------------------------------------" << endl;
swap_ranges(vec1.begin(), vec1.end(), deq1.begin());
for (auto vec_iter1 = vec1.begin(); vec_iter1 != vec1.end(); ++vec_iter1)
{
cout << *vec_iter1 << " ";
}
cout << endl;
cout << "------------------------------------------------------------" << endl;
for (auto vec_iter1 = deq1.begin(); vec_iter1 != deq1.end(); ++vec_iter1)
{
cout << *vec_iter1 << " ";
}
cout << endl;
cout << "------------------------------------------------------------" << endl;
system("pause");
return 0;
}
================================================================
0 1 2 3 4 5 6 7 8 9
------------------------------------------------------------
10 11 12 13 14 15 16 17 18 19 20 21 22
------------------------------------------------------------
10 11 12 13 14 15 16 17 18 19
------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 20 21 22
------------------------------------------------------------
请按任意键继续. . .