16.2.13 Standard Template Library
The Standard Template Library (STL) is a library of containers,
iterators and algorithms. I tend to think of the STL in terms of
the container classes it provides, with algorithms and iterators
necessary to make these containers useful. By segregating these roles,
the STL becomes a powerful library--containers can store any kind of
data and algorithms can use iterators to traverse the containers.
There are about half a dozen STL implementations. Since the
STL relies so heavily on templates, these implementations tend to
inline all of their method definitions. Thus, there are no precompiled
STL libraries, and as an added bonus, you're guaranteed to get the
source code to your STL implementation. Hewlett-Packard and SGI
produce freely redistributable STL implementations.
It is widely known that the STL can be implemented with complex C++
constructs and is a certain workout for any C++ compiler. The best
policy for choosing an STL is to use a modern compiler such as
GCC 2.95 or to use the STL that your vendor may have provided
as part of their compiler.
Unfortunately, using the STL is pretty much an `all or nothing'
proposition. If it is not available on a particular system, there are
no viable alternatives. There is a macro in the Autoconf macro archive
(see section 23.5.1 Autoconf macro archive) that can test for a working STL.
|