Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library User's Guide

4.1 Overview

The C++ Standard Library provides ten alternative forms of containers and three container adaptors. In this chapter we briefly identify these forms, consider their characteristics, and discuss how you might go about selecting which form to use in solving a particular problem. Subsequent chapters then go over each of the different forms in more detail.

Table 6 lists the container types provided by the C++ Standard Library, and describes the most significant characteristic of each. Table 7 does the same for the container adaptors.

Table 6: Container types provided by the C++ Standard Library 

Name Characteristic

vector

Random access to elements, efficient insertion at back

vector<bool>

Specialization of vector optimized for bool

list

Efficient insertion and removal throughout

deque

Random access, efficient insertion at front or back

set

Elements maintained in order, efficient tests for inclusion, insertion, and removal

multiset

Set with repeated copies

bitset

Bit container. Specialized on size rather than contained type

map

Access to values via keys, efficient insertion and removal

multimap

Map permitting duplicate keys

string

Character container enhanced for string operations

Table 7: Container adaptors of the C++ Standard Library

Name Characteristic

stack

Insertions and removals only from back

queue

Insertions at back, removals from front

priority_queue

Efficient access and removal of highest priority items



Previous fileTop of DocumentContentsIndex pageNext file