| Return type | ||
|---|---|---|
| Preincrement | ++i | X& |
| Postincrement | i++ | X |
Forward Iterator does not define any new expressions beyond those defined in Input Iterator. However, some of the restrictions described in Input Iterator are relaxed.
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Preincrement | ++i | |||
| Postincrement | i++ | Equivalent to |
The complexity of operations on Forward Iterators is guaranteed to be amortized constant time.
• T*
• hash_set<T>::iterator
Notes
[1] The restrictions described in Input Iterator have been removed. Incrementing a forward iterator does not invalidate copies of the old value and it is guaranteed that, if
Input Iterator, Output Iterator, Bidirectional Iterator, Random Access Iterator, Iterator overview
Bidirectional Iterator
Category: iterators
Component type: concept
A Bidirectional Iterator is an iterator that can be both incremented and decremented. The requirement that a Bidirectional Iterator can be decremented is the only thing that distinguishes Bidirectional Iterators from Forward Iterators.
Forward Iterator
The same as for Forward Iterator.
X A type that is a model of Bidirectional Iterator
T The value type of
i, j Object of type
t Object of type
In addition to the expressions defined in Forward Iterator, the following expressions must be valid.
| Name | Expression | Return type |
|---|---|---|
| Predecrement | --i | X& |
| Postdecrement | i-- | X |
Semantics of an expression is defined only where it is not defined in Forward Iterator.
| Name | Expression |
|---|
