I want to give the dimensions of the vector after declaring it through some other function.
This is because i will come to know the dimensions of vector afterwards.
Is there any way i can do that without using loops.
e.g
std::vector<std::vector<int>>my_vector;
........
........
........
and down in some other function i will declare the dimensions of it.
my_vector(2,5);
something like that….
or in C++11 as Xeo notes:
I think this approach is better than resize, because if you change the size several times, you might end up with a jagged matrix:
Now row one is 3 elements and row two is 5 elements.