C++使用数组初始化vector对象
#include<iostream>#include<string>
#include<vector>
#include<iterator>
using namespace std;
int main(void){
int array={
0,1,2,3,4,5,6,7,8,9
};
vector<int>v(begin(array),end(array));
for(auto i=v.begin();i<v.end();i++){
cout<<*i<<endl;
}
cout<<"v.size()=="<<v.size()<<endl;
return 0;
}
文档来源:51CTO技术博客https://blog.51cto.com/u_15302296/3072258
页:
[1]