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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.