Hi Guys,

In my current task , I need to read the read the approximately 10,000 recoreds from database and need to store the same in container.Now i need to select container to store all this records inorder to generate the report.Could you let me know whether i need to use vector or list and why? I have selected vector from my end as i don't require any kind of insertion in the middle and no searching effort is required.Apart from this after insertion i need to sort the all the records based on Name field.

2 Years
Discussion Span
Last Post by can-mohan

Thanks for your replay.i got to know that sorted vector will be more usefull then map if continous insertion and deletion and searching effort is not required.Apart from this i also would like to know what container would you suggest if sorting effor is not required at all.

below is the some usefull pointers which i found yesterday in scott meyers book (Effective STL)

Item 23. Consider replacing associative containers with sorted vectors

"**The standard associative containers are typically implemented as balanced binary search trees. A balanced binary search tree is a data structure that is optimized for a mixed combination of insertions, erasures, and lookups. That is, it's designed for applications that do some insertions, then some lookups, then maybe some more inser-tions, then perhaps some erasures, then a few more lookups, then more insertions or erasures, then more lookups, etc. The key characteristic of this sequence of events is that the insertions, erasures, and lookups are all mixed up. In general, there's no way to predict what the next operation on the tree will be"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.