The Standard Template Library Tutorial

Johannes Weidl-Rektenwald

Private Homepage of Johannes Weidl-Rektenwald
johannes.weidl@gmx.net

Last modified: 2004-02-15


This tutorial should give the interested reader a comprehensive survey on the Standard Template Library and should enable him to use the STL programming technique in his own programs.

ATTENTION: This tutorial has been written in 1995 (!) and may contain outdated (or maybe now wrong) information. Nevertheless, the concepts of generic component libraries which are presented should apply even today (and in the near to far future).

If you have suggestions, error reports or another message, please mail to Johannes Weidl-Rektenwald.

 


"The Standard Template Library (STL) is a C++ programming library that has been developed by Alexander Stepanov and Meng Lee at the Hewlett Packard laboratories in Palo Alto, California. It was designed to enable a C++ programmer to do generic programming and is based on the extensive use of templates - also called parametrized types. This paper tries to give a comprehensive and complete survey on the STL programming paradigm and shall serve as step-by-step tutorial for the STL newcomer, who has fundamental knowledge in C++ and the object-oriented paradigm."

Table of contents


1 Introduction

2 C++ basics

2.1 Classes

2.2 Function objects

2.3 Templates

2.3.1 Function templates

2.3.2 Class templates

2.3.3 Template member functions

2.3.4 Template specialization

3 A STL overview

3.1 STL availability and information

3.1.1 FTP-Sites

3.1.2 URLs

3.2 What does STL consist of?

3.3 Compiling STL programs

3.3.1 Borland C++ 4.x DOS-programs

3.3.2 Borland C++ 4.x WINDOWS-programs

3.3.3 Borland C++ 4.5 DOS- and WINDOWS-programs

4 Learning STL

4.1 Containers

4.1.1 Vector

4.1.2 Exercises

4.2 Iterators

4.2.1 Input Iterators and Output Iterators

4.2.2 Forward Iterators

4.2.3 Bidirectional Iterators

4.2.4 Random Access Iterators

4.2.5 Exercises

4.3 Algorithms and Function Objects

4.3.1 How to create a generic algorithm

4.3.2 The STL algorithms

4.3.3 Exercises

4.4 Adaptors

4.4.1 Container Adaptors

4.4.2 Iterator Adaptors

4.4.3 Function Adaptors

4.5 Allocators and memory handling

5 The remaining STL components

5.1 How components work together

5.2 Vector

5.3 List

5.4 Deque

5.5 Iterator Tags

5.6 Associative Containers

6 Copyright

7 Literature


Johannes Weidl-Rektenwald (johannes.weidl@gmx.net)