Jump to content
  • Advertisement
Sign in to follow this  

Resticting vector size

This topic is 4436 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 have a vector which can have items added into it at any time, but I want to restrict it's size to 200. So if an object gets past the position of 200 in the vector, then it just gets deleted from the vector. The code I am currently using (which does not seem to be working) is as follows:
if(SMParticles.size() > 200)
	for(int i = 0; i < (SMParticles.size() - 200); i++)

	std::vector<Particle> Temp;
	Temp.assign(SMParticles.begin(), SMParticles.end());

Any help on getting this to work is much appreciated, -Chris

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!