Re: STL container question
For that case, I think std::list is a better option, since the sorting will be faster
Lists are implemented using pointers to point to the previous and to the next elements, so list::sort(), is more efficient by changing pointer values, while sorting a vector involves copying objects.
Re: STL container question
The original poster talked about storing integer values. I highly doubt sorting a list of integers will be faster than sorting an array of integers. In fact, I'm pretty sure of the contrary.
Re: STL container question
And you really think that doing two pointer exchanges is faster than one integer exchange?
However, it can still be slower, since it's more or less the worst thing you
can do to the cache.
Re: STL container question
Still, you should only get one cache-miss when looking for a value, if you use a set or vector you will probably get more.