Programming and Graphics

(Kiana) #1

G The Standard Template Library 365


Alist is a sequence of elements stored in a linked list. Compared to
vectors, the list offers fast insertion and deletion but slower random access.


Aqueueis a container adapter offering a FIFO (first-in, first-out) data
structure.


Apriority queueis aqueue, but the elements inside the data structure
are ordered by some predicate.


Adequeprovides a dynamic array structure with random access, and
offers fast insertion and deletion of elements at the front and back of the array.


Astack is a container adapter offering the functionality of a stack –
specifically, a FILO (first-in, last-out) data structure.


Aset is an associative container encapsulating a sorted set of unique
objects.


Amultisetis an associative container allowing for duplicate objects.

A map is a sortedassociative container containing unique key/value
pairs. For example, a map can be defined to associate a string with an in-
teger, and then used to associate the number of days in each month with the
name of each month.


Amultimapdiffers from amapin that it permits duplicate keys; that is,
it allows a key to map more than one element.


Abitsetallows a set of bits to be used as a data structure. Bitsets can
be manipulated by various binary operators such as logical AND and OR.


Aniteratoris used to access members of the container classes in lieu of
a pointer. For example, an iterator can be used to step through the elements
of a vector.


Avalarrayoffers efficient implementations for arrays, but lacks certain
standard container functions.

Free download pdf