Sign in to follow this  

Resizeable arrays

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

This topic is 4836 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this