vector与array之间转换,向量与数据之间转换
一维数组:
vector<int> a;
int b[5] = {1,2,3,4,5};
a.push_back(b);
二维数组:
b[5][6] = {1,2,3,4,5,6...27,28,29,30};
如果a的长度给定了,即vector<vector<int> > a(5,vector<double>(6));
for(int i = 0; i < 5;++i){
for (int j = 0; j < 6; ++j){
a[i][j]=b[i][j];
}
}