C++ 在2dim向量中插入一个值?
我将一个2dim数组复制到一个向量中,如下所示C++ 在2dim向量中插入一个值?,c++,vector,C++,Vector,我将一个2dim数组复制到一个向量中,如下所示 vector< vector<int>> path2; vector<int> temp; // For simplicity for (int x = 0; x <= 1; x++) {temp.clear(); for (int y = 0; y < 4; y++) { temp.push_back(path1[x][y]); } path2.p
vector< vector<int>> path2;
vector<int> temp; // For simplicity
for (int x = 0; x <= 1; x++)
{temp.clear();
for (int y = 0; y < 4; y++)
{
temp.push_back(path1[x][y]);
}
path2.push_back(temp);
}
现在如何在1和3之间插入4
提前感谢您使用
path2[1]。插入(path2[1]。开始()+2,4)代码>
path2[0][6,0,2,6]
path2[1][6,1,3,6]