Jump to content
  • Advertisement
Sign in to follow this  
hiigara

[STL] Is there a Circular Array Data Structure in STL?

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

Advertisement
Quote:
Original post by hiigara
I need to store the last n States of my Simulation.


If all else fails, you can just do something like:

std::deque<state> prevStates;

void addState(const state &s)
{
prevStates.push_back(s);
if (prevStates.size() > MAX_NUM_STATES)
prevStates.pop_front();
}

Share this post


Link to post
Share on other sites
Ah, right. It's actually like a circular buffer made up of a linked list of vectors, or something :/

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!