Chapter 3. Container Basics

Ah, when she moved, she moved more ways than one:The shapes a bright container can contain!

— “I Knew a Woman”THEODORE ROETHKE

The Standard Template Library, more commonly known as the STL,[1] is the invention of Dave Musser, Alex Stepanov, and Meng Lee. The design of the STL factors common programming tasks into four fundamental components: sequences, algorithms, iterators, and callable types.[2] As we’ll see, the STL and the standard C++ library provide templates that aid in programming with all four of these components.

In addition, the STL and the standard C++ library have several containers that hold sequences of elements. The TR1 library provides five new containers: a fixed-size array (Chapter 4), unordered ...

Get The C++ Standard Library Extensions A Tutorial and Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.