Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide


Library:  Containers

Local Index

No Entries


A standard template library (STL) collection


Within the Standard Template Library, collection classes are often described as containers. A container stores a collection of other objects and includes basic functions that support the use of generic algorithms. Containers come in two types: sequences and associative containers. They are further distinguished by the type of iterator they support.

A sequence supports a linear arrangement of single elements. vector, list, deque, bitset, and string fall into this category. Associative containers map values onto keys, which allows for retrieval of the values based on the keys. The STL includes the map, multimap, set, and multiset associative containers. map and multimap store the value and the key separately, and allow for fast retrieval of the value, based upon fast retrieval of the key. set and multiset store only keys allowing fast retrieval of the key itself.

Container Requirements

Containers within the STL must meet the following requirements. The requirements for containers are:

Reversible Containers

A container may be reversible. Essentially, a reversible container includes a reverse iterator that allows traversal of the collection in a direction opposite that of the default iterator. A reversible container must meet the following requirements in addition to those listed above:


In addition to the requirements for containers, the following requirements hold for sequences:

Associative Containers

In addition to the requirements for a container, the following requirements hold for associative containers:

See Also

bitset, deque, list, map, multimap, multiset, priority_queue, queue, set, stack, vector

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 23

Previous fileTop of DocumentContentsIndex pageNext file