Jump to content
  • Advertisement
Sign in to follow this  
Zeophlite

Resizeable arrays

This topic is 5421 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

I want to place all my explosions into one array: CExplosion *explosions; This way I can loop through the entire array and draw each explosion Then be able to resize it at any time. Namely, I want two functions, addexp and delexp(int x) addexp adds one cell to the array, delexp removes explosions[x] and every cell after x is renumbered -1 and the last cell is deleted I as thinking of using new and delete, but does that mean I have to delete the entire array, and reinhabit it with the new set of values - that sounds like it may take a while... Are there any other options? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Try using a vector. They're resizeable and can be as fast, if not faster than, standard arrays. They're part of the STL.
[EDIT: just saw the above post, and I agree that a list would probably be a better choice]

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!