标签:
//数组初始化vector
int iarray[]={1,2,3,4,5,6,7,8,9,0};
//count: iarray数组个数
size_t count=sizeof(iarray)/sizeof(int);
//int数组初始化 ivec3
vector<int> ivec3(iarray,iarray+count);
for(int_ite=ivec3.begin ();int_ite!=ivec3.end ();int_ite++)
cout<<"ivec3: "<<*int_ite<<endl;
//string数组初始化 svec1
string word[]={"ab","bc","cd","de","ef","fe"};
//s_count: word数组个数
size_t s_count=sizeof(word)/sizeof(string);
//string数组初始化 svec1
vector<string> svec1(word,word+s_count);
for(string_ite=svec1.begin ();string_ite!=svec1.end ();string_ite++)
cout<<"svec1: "<<*string_ite<<endl;
标签:
原文地址:http://www.cnblogs.com/Travis990/p/4468920.html