Jump to content
  • Advertisement
Sign in to follow this  
Funkymunky

2d std::vector array resizing?

This topic is 3991 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im getting a crash when i try to resize a 2 dimensional vector of ints, declared as such:
std::vector<std::vector<int>> map
i try to resize the "x" dimension like so:
for(int i=0; i<map.size(); i++)
    map.resize(newnum);
yet i get a crash (send error report type crash). why is that?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Funkymunky
yet i get a crash (send error report type crash). why is that?
Because you're not running your code in the debugger, which would tell you more precisely what's wrong; E.g. if it's an access violation, what address was causing it, and point you to the line that was causing it.

You should ALWAYS be running code in the debugger until you think it's completely bug free.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!