C++ container

  • Thread starter Thread starter featips
  • Start date Start date
Joined
2/26/09
Messages
76
Points
16
In C++ textbook, there are topics in sequential container, associative container, generic algorithms. Do you guys often use these for data structure in your work?

Or, linked data structure construced with class is sufficient for programming on data ?
 
Yes, I often use them.

Hi Eugene, thanks a lot for reply.

From the viewpoint of application, what's the difference between linked data structure, and containers? From my understanding, the data structure can be programmed by both linked data structure approach and container approach, but I feel like using class to construct linked data structure is clean, straightforward, no need to remember or search those container member operations.......

I am learning C++ now, so my question may be superficial...thanks for reply.
 
re-inventing the wheel is always bad, unless you can make the car fly because of it.
 
Hi Eugene, thanks a lot for reply.

From the viewpoint of application, what's the difference between linked data structure, and containers? From my understanding, the data structure can be programmed by both linked data structure approach and container approach, but I feel like using class to construct linked data structure is clean, straightforward, no need to remember or search those container member operations.......

I am learning C++ now, so my question may be superficial...thanks for reply.

STL containers are very useful and good to know: vectors, maps, lists, etc. You can encapsulate most data that you work with through these. Another good source is boost ( Boost C++ Libraries ). If you are learning c++, I recommend getting to know boost since there are many useful libraries there.

---------- Post added at 11:54 AM ---------- Previous post was at 11:51 AM ----------

So your opinion is to stick with container provided by C++ standard library, right?

These are also written by people who know what they are doing. Using STL is much more stable than making up your own, unless your name starts with 'B' and ends with 'ill Gates'.
 
The choice of data structure is determined by the kind of problem you have; for example, using a list to create a collection of names and telephone number is OK until you want to search (fast) for specific name, then list search will be slooow. Instead, we use a map<key, value>

The precise issue here is Complexity Analysis

http://en.wikipedia.org/wiki/Analysis_of_algorithms


In some applications a map is not enough and then a tree or boost graph might be more useful.
 
Back
Top Bottom