Книга: Standard Template Library Programmer
Forward Container
Разделы на этой странице:
Forward Container
Category: containers
Component type: concept
Description
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 Equality Comparable) and of lexicographical ordering (if the container's element type is LessThan Comparable).
Iterators into a Forward Container satisfy the forward iterator requirements; consequently, Forward Containers support multipass algorithms and allow multiple iterators into the same container to be active at the same time. Refinement of Container, EqualityComparable, LessThanComparable
Associated types
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 Forward Iterator.
Notation
X
A type that is a model of Forward Container
a, b
Object of type X
T
The value type of X
Valid expressions
In addition to the expressions defined in Container, EqualityComparable, and LessThanComparable, the following expressions must be valid.
Name | Expression | Type requirements | Return type |
---|---|---|---|
Equality | a == b |
T is EqualityComparable | Convertible to bool |
Inequality | a != b |
T is EqualityComparable | Convertible to bool |
Less | a < b |
T is LessThanComparable | Convertible to bool |
Greater | a > b |
T is LessThanComparable | Convertible to bool |
Less or equal | a <= b |
T is LessThanComparable | Convertible to bool |
Greater or equal | a >= b |
T is LessThanComparable | Convertible to bool |
Expression semantics
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 | Semantics |
---|---|---|
Equality | a == b |
Returns true if a.size() == b.size() and if each element of a compares equal to the corresponding element of b. Otherwise returns false. |
Less | a < b |
Equivalent to lexicographical_compare(a,b) |
Complexity guarantees
The equality and inequality operations are linear in the container's size.
Invariants
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. |
Models
• vector
• list
• slist
• deque
• set
• hash_set
• map
• hash_map
• multiset
• hash_multiset
• multimap
• hash_multimap
See also
The iterator overview, Forward Iterator, Sequence
- Associative Container
- Reversible Container
- Container
- FORWARD chain
- Forwarding Email with Aliases
- Forward Zone
- Multiple Associative Container
- Forwarding
- Forwarding virtual-hosted mail to other destinations
- Работа с ToolStripContainer
- CHAPTER 10 Employing Fancy Widgets and Containers
- 17.2.4. Включение IP Forwarding