|Category: containers ||Component type: concept |
A Forward Container is a Container whose elements are arranged in a definite order: the ordering will not change spontaneously from iteration to iteration. The requirement of a definite ordering allows the definition of element-by-element equality (if the container's element type is EqualityComparable) and of lexicographical ordering (if the container's element type is LessThanComparable).
Iterators into a Forward Container satisfy the ForwardIterator requirements; consequently, Forward Containers support multipass algorithms and allow multiple iterators into the same container to be active at the same time.
Container, EqualityComparable, LessThanComparable
No additional types beyond those defined in Container. However, the requirements for the iterator type are strengthened: the iterator type must be a model of ForwardIterator.
|A type that is a model of Forward Container |
|Object of type |
|The value type of |
In addition to the expressions defined in Container, EqualityComparable, and LessThanComparable, the following expressions must be valid.
Semantics of an expression is defined only where it is not defined in Container, EqualityComparable, or LessThanComparable, or where there is additional information.
|Name ||Expression ||Precondition ||Semantics ||Postcondition |
a == b
| ||Returns |
a.size() == b.size() and if each element of
a compares equal to the corresponding element of
b. Otherwise returns
a < b
| ||Equivalent to |
The equality and inequality operations are linear in the container's size.
|Ordering ||Two different iterations through a forward container will access its elements in the same order, providing that there have been no intervening mutative operations. |
The Iterators, ForwardIterator, Sequence