#include <iostream>
#include <vector>
#include <list>
#include <string>
using namespace std;
int main()
{
list<int> ilst(5,4);
vector<int> ivc(5,5);
//form list<int> to vector<double>
vector<double> dvc(ilst.begin(),ilst.end());
for(auto i : ilst)
cout<<i<<" ";
cout<<endl;
for(auto i : dvc)
cout<<i<<" ";
cout<<endl;
//form vector<int> to vector<double>
vector<double> dvc2(ivc.begin(),ivc.end());
for(auto i : ivc)
cout<<i<<" ";
cout<<endl;
for(auto i : dvc2)
cout<<i<<" ";
cout<<endl;
}
顺序容器之间的拷贝
最新推荐文章于 2022-10-26 10:20:53 发布