C++ Notes: STL: Containers: Introduction

The STL (Standard Template Library) provides a number of predefined containers (data structures), most of which are generalize as templates to hold any type element. By far the most commonly used are string and vector.

Sequence containers

These containers hold sequences of data elements.

Associative containers

Associative containers contain key/value pairs, providing access to each value using a key. The elements are sorted by the key. Usually implemented as a balanced binary tree.

Ordered sets

The set containers keep the elements in them in order, and are usually implemented as balanced binary trees. They do not implement standard set operations (union, intersection, ...) as you might expect from the name.

Container adapters

These are based on other containers, and are used only to enforce access rules. Because there are special access restrictions, they have no iterators.

Specialized containers

The following containers are specialized in some ways: specific data type, special utility routines, limited, but fast, implementations.