Standard C++ Library Class Reference
A container allocates all storage for the objects it holds.●
A container X of objects of type T provides the following types:
X::value_type a T
X::reference lvalue of T
X::const_reference const lvalue of T
X::iterator an iterator type pointing to T. X::iterator cannot be an output
iterator.
X::const_iterator an iterator type pointing to const T. x::iterator cannot be an output
iterator.
X::difference_type a signed integral type (must be the same as the distance type for
X::iterator and X::const_iterator
X::size_type an unsigned integral type representing any non-negative value of
difference_type
●
●
A container provides a default constructor, a copy constructor, an assignment operator,
and a full complement of comparison operators (==, !=, <, >, <=, >=).
●
A container provides the following member functions:
begin() Returns an iterator or a const_iterator pointing to the first element in
the collection.
end() Returns an iterator or a const_iterator pointing just beyond the last
element in the collection.
swap(container) Swaps elements between this container and the swap's argument.
clear() Deletes all the elements in the container.
size() Returns the number of elements in the collection as a size_type.
max_size() Returns the largest possible number of elements for this type of
container as a size_type.
empty() Returns true if the container is empty, false otherwise.
●
Reversible Containers
A container may be reversible. Essentially, a reversible container provides a reverse iterator that
allows traversal of the collection in a direction opposite that of the default iterator. A reversible
container must meet the following requirements in addition to those listed above:
A reversible container provides the following types:
X::reverse_iterator An iterator type pointing to T.
●