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.
The same as for Forward Iterator.
X | A type that is a model of Bidirectional Iterator |
T | The value type of X |
i, j | Object of type X |
t | Object of type T |
In addition to the expressions defined in Forward Iterator, the following expressions must be valid.
| Name | Expression | Type requirements | 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 | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Predecrement | --i | i is dereferenceable or past-the-end. There exists a dereferenceable iterator j such that i == ++j. | i is modified to point to the previous element. | i is dereferenceable. &i = &--i. If i == j, then --i == --j. If j is dereferenceable and i == ++j, then --i == j. |
| Postdecrement | i-- | i is dereferenceable or past-the-end. There exists a dereferenceable iterator j such that i == ++j. | Equivalent to
{
X tmp = i;
--i;
return tmp;
}
|
The complexity of operations on bidirectional iterators is guaranteed to be amortized constant time.
| Symmetry of increment and decrement | If i is dereferenceable, then ++i; --i; is a null operation. Similarly, --i; ++i; is a null operation. |
T* IndexedSkipList< T, R >::iterator IndexedSkipList< T, R >::const_iterator SkipList< T, Pr, R >::iterator SkipList< T, Pr, R >::const_iterator AutoSkipList< T, Pr, R >::iterator AutoSkipList< T, Pr, R >::const_iterator MultiSkipList< T, Pr, R >::iterator MultiSkipList< T, Pr, R >::const_iterator MultiAutoSkipList< T, Pr, R >::iterator MultiAutoSkipList< T, Pr, R >::const_iterator KeyedSkipList< K, T, Pr, R >::iterator KeyedSkipList< K, T, Pr, R >::const_iterator KeyedMultiSkipList< K, T, Pr, R >::iterator MultiKeyedSkipList< K, T, Pr, R >::const_iterator AutoKeyedSkipList< K, T, Pr, R >::iterator AutoKeyedSkipList< K, T, Pr, R >::const_iterator KeyedAutoMultiSkipList< K, T, Pr, R >::iterator MultiAutoKeyedSkipList< K, T, Pr, R >::const_iterator XIndexedSkipList< X, CT >::iterator XIndexedSkipList< X, CT >::const_iterator XMultiSkipList< X, CT, Pr >::iterator XMultiSkipList< X, CT, Pr >::const_iterator XMultiAutoSkipList< X, CT, Pr >::iterator XMultiAutoSkipList< X, CT, Pr >::const_iterator AccessSkipList< K, T, A, Pr, R >::iterator AccessSkipList< K, T, A, Pr, R >::const_iterator MultiAccessSkipList< K, T, A, Pr, R >::iterator MultiAccessSkipList< K, T, A, Pr, R >::const_iterator AutoAccessSkipList< K, T, A, Pr, R >::iterator AutoAccessSkipList< K, T, A, Pr, R >::const_iterator MultiAutoAccessSkipList< K, T, A, Pr, R >::iterator MultiAutoAccessSkipList< K, T, A, Pr, R >::const_iterator XMultiAccessSkipList< X, K, CT, A, Pr >::iterator XMultiAccessSkipList< X, K, CT, A, Pr >::const_iterator XMultiAutoAccessSkipList< X, K, CT, A, Pr >::iterator XMultiAutoAccessSkipList< X, K, CT, A, Pr >::const_iterator SkipList, KeyedSkipList, AutoSkipList, AutoKeyedSkipList, MultiSkipList, MultiKeyedSkipList, MultiAutoSkipList, MultiAutoKeyedSkipList, IndexedSkipList, XIndexedSkipList, XMultiSkipList, XMultiAutoSkipList, AccessSkipList, AutoAccessSkipList, MultiAccessSkipList, MultiAutoAccessSkipList, XMultiAccessSkipList, XMultiAutoAccessSkipList,
Input Iterator, Output Iterator, Forward Iterator, Bidirectional Iterator LOGN, Random Access Iterator, Random Access Iterator LOGN, Arbitrary Access Iterator LOGN, Forward Arbitrary Access Iterator, Forward Arbitrary Access Iterator LOGN, Reverse Arbitrary Access Iterator, Reverse Arbitrary Access Iterator LOGN, Iterator Overview
1.7.3