[Effective-cpp] Item 1: Choose Your Containers With Care
Robert W Hand
rwhand at worldnet.att.net
Sat Jun 28 08:38:44 EDT 2003
At 09:46 AM 6/28/2003 +0100, you wrote:
>Scott finishes the item with a list of questions aimed to help choose
>the appropriate container. I think this could have been presented better
>as a tree diagram where one question leads on from the next depending on
>how it is answered and all branches lead finally to a container. I've
>often thought this would be a good exercise for the Linux \ STL project.
>If I get chance I'll knock up a diagram and a small application which
>helps choose containers in this way.
I think that this is the crux of the article. Scott wants us to stop
thinking about containers as "generic containers". I often see written a
comment that one can design and write a program without regard to the
container type. The claim is that the programmer can switch from one
container to another type (say vector to list) at any time, perhaps in
response to performance issues that are noted during the testing
phase. Scott's main point is that the container type is part of the design.
So I would be interested in seeing your decision tree, but I think that
Scott is trying to get us to think about container types in the design
phase. Such thinking should not be too mechanical.
Nice review.
Bob
Best wishes,
Robert W Hand
More information about the Effective-cpp
mailing list