Chapter 28. Standard Library Reference

This reference shows the most useful classes and functions in the standard library.

Note that the syntax "[start, end)" refers to a half-open iterator range from start to end, as described in Chapter 21.

Containers

The STL divides its containers into three categories. The sequential containers include the vector, list, and deque. The associative containers include the map, multimap, set, and multiset. The container adapters include the stack, queue, and priority_queue. Additionally, the bitmap and string can be considered STL containers as well.

Common Typedefs

Most sequential and associative containers that are part of the standard define the following types, which have public access and are used in the method prototypes. Note that not all these typedefs are required by the standard in order to qualify as an STL container. However, most of the containers in the STL provide them (exceptions are noted after the following table).

Type Name

Description

value_type

The element type stored in the container.

reference

A reference to the element type stored in the container.

const_reference

A reference to a const element type stored in the container.

pointer

A pointer to the element type with which the container is instantiated (not required by the standard, but defined by all the containers).

const_pointer

A pointer to a const element type with which the container is instantiated (not required by the standard, but defined by all the containers).

iterator ...

Get Professional C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.