The STL is not an abstraction; it is a shortcut.In computer programming, an abstraction is something that hides the details. Abstractions let us get stuff done, and most of the time they leak. Is the STL the leakiest abstraction in the universe?
No. It's not an abstraction at all. Abstractions hide implementation from you - the STL simply provides implementation.
An indication that the STL is an abstraction would be that you could change the implementation of an STL algorithm or container and not notice. Does the STL meet that criteria? I don't think so, at least not in any sane way.
With the STL, you need to know all of the fine print for any algorithm or class you do. Picking the type means picking an algorithm or data structure for its strengths and weaknesses. For example, if you pick vector, you are picking the following:
- A simple, compact representation.
- Blazingly fast random access iteration.
- The copy constructor of your data is going to be called a gajillion times.
- Mutating the size of the vector is going to hose outstanding iterators.
- Non-far-end insertion and deletion cost a fortune.
And that's okay; typing vector