c++ - Insert a value in 2dim vector? -


i copied 2dim array vector below

vector< vector<int>> path2;  vector<int> temp; // simplicity  (int x = 0; x <= 1; x++) {temp.clear();     (int y = 0; y < 4; y++)     {         temp.push_back(path1[x][y]);     }     path2.push_back(temp);  } 

now want inser value in second dimention how can it?(i know how use inser() in 1 dim vector)

for example

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

now how can insert 4 between 1 , 3 ?

thank in advance

using std::vector::insert

path2[1].insert( path2[1].begin()+2, 4 );


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -