Question

Do you just base your STL container selections on the following attributes?

  1. Searching/Updating
  2. Insertion and
  3. Deletion

If not, what else do you base your selections upon? Is there any reference out there that lists how each container performs across all these different attributes?

Was it helpful?

Solution

+1 for effective STL.

But if you need an on-line reference, there is a good flowchart in StackOverflow Question 471432

OTHER TIPS

Scott Meyers' Effective STL covers not only this, but the weird pitfalls that you'll run into with some of the odder containers like set.

Guarantee that the data is placed in continuous memory can be important. Typically if you are interested in using the data in the structure with interfaces that looks like doSomething(int* data, int dataCount).

I start of by thinking about the "shape" of the data, how often each item can repeat etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top