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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -