Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/149.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在2dim向量中插入一个值?_C++_Vector - Fatal编程技术网

C++ 在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

我将一个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.push_back(temp);

}
现在如何在1和3之间插入4

提前感谢您使用

path2[1]。插入(path2[1]。开始()+2,4)

path2[0][6,0,2,6]
path2[1][6,1,3,6]