O'Reilly logo

C++ Primer Plus, Fourth Edition by Stephen Prata

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Members Common to All Containers

All containers define the types in Table G.1. In this table, X is a container type, such as vector<int>, and T is the type stored in the container, such as int.

Table G.1. Types Defined for All Containers
Type Value
X::value_type T, the element type
X::reference Behaves like T &
X::const_reference Behaves like const T &
X::iterator Iterator type pointing to T, behaves like T *
X::const_iterator Iterator type pointing to const T, behaves like const T *
X::difference_type Signed integral type used to represent the distance from one iterator to another; for example, the difference between two pointers
X::size_type Unsigned integral type size_type can represent size of data objects, number of elements, and subscripts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required