Hello-
Ive never used a vector or vectors in C++ so I have a question for you
all.
I know I can dynamically create the size I need upfront, but is it
possible to
create them on the fly dynamically? That is, for a 2 dim array, I want
to create
the first element and then push_back the columns after that:
This code obviously does not work, but this is how I percieve it to
create the
initial 'x' or row element, then add each column after that.
int hist_idx = 0;
vector< <vector<int> > history;
history.push_back(hist_idx);
then
history[hist_idx].push_back(5);
history[hist_idx].push_back(2);
etc
If I have to statically create it upfront, is it possible to re-size it
when I reach
the limit without losing the current data already in 'history'? If so
how?
Thanks,
Jeff