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.
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 ... |
Get C++ Primer Plus, Fourth Edition 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.