i wanna make a vector of vector with no definite row and column, i mean the row and column must cin by user, or a stream file. okay, how should i build it ?
well, i have no idea about vector of vector that have no certain size, i mean row and column, the only thing that i know, its vector of vector with definite size ( row and column ) by 2 for loop. hope to could convey mean.
well, i have no idea about vector of vector that have no certain size, i mean row and column, the only thing that i know, its vector of vector with definite size ( row and column ) by 2 for loop.
for illustration, suppose that we have a txt file as cin ( by ifstream command ), with million of data, the first one is row and the second one as column. the data will update at the same time, its mean we have no definite size row and column. it grows by time. more precisely a 2D dynamic vector. hope to could convey mean.
edit: I think I get what you mean. I don't know if this is the same topic as that other post.
You should know the vector itself was designed to be dynamc.
push_back() will come in handy for you by your description.
If you have to spontaneously increase the number of columns for every row then use a for-loop.
1 2
for(auto i: vec)
i.resize(/* new column size */);
But don't resize all rows if they won't have any information because it will be a waste of memory. If you were to print the vectors using a for-loop then you could just skip reach the end of the row.