I need to store last n time values and I'm using a vector for this. I can do this and it works, but my question is, at long run, the vector would fill up and I might run out of memory right?. I'm using a stl vector of floats.
To be more clear : I'm pushing back time values from another process and i ONLY need the last 5 time values.
How can I do this efficiently, without letting the vector fill up and eventually run out of memory?
Sounds as if you want a circular buffer that overrides the values.
Take a look at boost for an example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With