- The Standard Template Library (STL)
- Standard
- Part of any standards-compliant C++ compiler.
- Requires advanced features (default template values, for example).
- Some compilers (Microsoft Visual C++ 6.0, for example) can't hack
it.
- Include files don't end in
.h
.
- Everything's defined in the
std
namespace.
- Template
- Not a lot of object play involved.
- Templates give the STL its power, and make it hard to use.
- Subtle errors, humungous error messages.
- Library
- Actually just header files, no libraries involved.
- Six main components; three we'll study, three we won't.
- The three main components are containers, iterators and generic
algorithms.
- Containers are data structures
- iterators reference data in containers.
- Generic algorithms manipulate data referenced by iterators.
- The other three components.
- Functors are objects that act like functions.
- Adaptors change container behavior.
- Allocators
- Sequential and sorted associative containers.
- Sequence containers represent data sequences.
- Ordinary c++ arrays.
- STL vectors are dynamic arrays.
- Similar to pointers.
- Relative to containers, unlike pointers.
- More accurately called accessors.
- How do algorithms get at the contents of a container - via the
iterators provided by each container
- The most important part of the STL.
-
find(start, end, item)
- look for item
in the container
part delimited by start
and end
.
- lots more
This page last modified on 24 September 2002.