Next : Random access iterators, Previous : Forward iterators, Top : Table of Contents
-- | Operator on bidirectional iterators |
A class or a built-in type
X satisfies the requirements
of a bidirectional iterator if the following lines are added to the table that specifies forward
iterators:
Expression | Return type | Operational semantics | Assertion/note pre/post-condition |
--r | X& | pre: there exists
s such that
r == ++s. post: s is dereferenceable. --(++r) == r. --r == --s implies r == s. &r == &--r. | |
r-- | X | { X tmp = r; --r; return tmp; } |
NOTE: Bidirectional iterators allow algorithms to move iterators backward as well as forward.
|