Category: iterators | Component type: concept |
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 |
Name | Expression | Type requirements | Return type |
---|---|---|---|
Predecrement | --i | X& | |
Postdecrement | i-- | X |
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; } |
Symmetry of increment and decrement | If i is dereferenceable, then ++i; --i; is a null operation. Similarly, --i; ++i; is a null operation. |