Is there a way to clear the contents of std::vector while retaining the memory allocation?
The reason for this is that I have a section of code which loops, and I wish to optimize this. I currently have data stored in std::vectors. Each time the loop begins the contents of the vector should be cleared. I then use push_back to enter data into the vector, however since the length of the vector does not often change between iterations of the loop, I would ideally like the vector to retain its allocated storage in memory.
If this is not possible with vector is it possible with another fast access STD type?