A modest STL tutorial
By Jak Kirman
I am using a software tool called hyperlatex to create this document. The tutorial is also available in
compressed postscript form. For those wanting to install a copy of these pages on their system, they
may be freely copied providing they are not modified in any significant way (other than, say, locale
changes). The file tutorial.tar.Z contains a tarred distribution of the pages. Please note that I will be
making modifications to this document in the coming months, so you may want to occasionally
check for changes. I will start putting in version numbers, and if I can manage to, changebars.
Disclaimer
I started looking at STL a little over a year ago; for a long time I could compile only minimal
subsets of the HP version of the library. More recently, the compilers used by the students I teach
have been able to support more of STL, and I have been adding it to the introductory and advanced
courses I teach.
I have been using C++ for six or seven years, and teaching C++ and object-oriented design courses
in industry for five. I really like the design philosophies in STL; I think that you can learn a great
deal about how generalization can simplify programming by understanding why STL is constructed
the way it is.
At the moment, books are starting to appear on STL; I haven’t yet bought any of them, but I have
looked at some. I would be very interested to hear peoples’ opinions of any books written on STL.
I haven’t seen very much online documentation on STL, apart from the good but rather dense paper
by Stepanov and Lee, I thought I would try to write something to give people a taste of what a good
library will be do for them.
Another reason for getting people to start trying out STL soon is to put pressure on the
compiler-writers to get their compilers patched up enough to take the strain it puts on them...
This is a fairly recent project (started April 1995) to which I can’t devote too much time, so it is still
very short, and pretty poorly organized.
I would greatly appreciate comments or suggestions from anyone.
Outline
STL contains five kinds of components: containers, iterators, algorithms, function objects and
allocators.
In the section Example I present a simple example, introducing each of the five categories of STL
components one at a time.
In the section Philosophy I explain the rationale behind the organization of STL, and give some
hints on the best ways to use it. (Not yet written)