Top of document
©Copyright 1999 Rogue Wave Software

Overview

The standard library provides no fewer than ten alternative forms of container. In this section we will briefly describe the varieties, considering the characteristics of each, and discuss how you might go about selecting which container to use in solving a particular problem. Subsequent sections will then go over each of the different containers in more detail.

The following chart shows the ten container types provided by the standard library, and gives a short description of the most significant characteristic for each.

Name
Characteristic
vector
random access to elements, efficient insertions at end
list
efficient insertion and removal throughout
deque
random access, efficient insertion at front or back
set
elements maintained in order, efficient test for inclusion, insertion and removal
multiset
set with repeated copies
map
access to values via keys, efficient insertion and removal
multimap
map permitting duplicate keys
stack
insertions and removals only from top
queue
insertion at back, removal from front
priority queue
efficient access and removal of largest value

Top of document