2d vector problem

In order to use a 2d vector, I have to reverse the size of it first ,but when i do this

 
  vector <vector <troops*> >grid(100);


neither this

 
  vector <vector <troops*> >grid(100, vector<troops*> (100,nullptr));


works
troops is a class
Last edited on
I have to reverse the size of it first

You have to do ... what?

"It doesn't work" is not a very helpful explanation.

There's nothing wrong per se with either fragment of code - you will have to provide more.


Topic archived. No new replies allowed.