# include<iostream>
# include<vector>
using namespace std;
//容器中嵌套容器
void test01()
{
vector<vector<int>> v;
//先创建小容器
vector<int> v1;
vector<int> v2;
vector<int> v3;
vector<int> v4;
vector<int> v5;
for (int i = 0; i < 5; i++)
{
v1.push_back(i + 1);
v2.push_back(i + 2);
v3.push_back(i + 3);
v4.push_back(i + 4);
v5.push_back(i + 5);
}
//将小容器中数据插入到大的容器中
v.push_back(v1);
v.push_back(v2);
v.push_back(v3);
v.push_back(v4);
v.push_back(v5);
//通过大容器,把所有数据都遍历一遍
for ( vector<vector<int> >::iterator it = v.begin(); it != v.end(); it++)
{
//(*it) -- 容器 vector<int>
cout << "***********" << endl;
for (vector<int>::iterator vit = (*it).begin(); vit != (*it).end(); vit++)
{
cout << *vit<<" ";
}
cout << endl;
}
}
int main()
{
test01();
system("pause");
return 0;
}