2.2 KiB
2.2 KiB
[bidirectional.iterators]
24 Iterators library [iterators]
24.3 Iterator requirements [iterator.requirements]
24.3.5 C++17 iterator requirements [iterator.cpp17]
24.3.5.6 Bidirectional iterators [bidirectional.iterators]
A class or pointer typeX meets the requirements of a bidirectional iterator if, in addition to meeting the Cpp17ForwardIterator requirements, the following expressions are valid as shown in Table 82.
Table 82 — Cpp17BidirectionalIterator requirements (in addition to Cpp17ForwardIterator) [tab:bidirectionaliterator]
| ð Expression |
Return type | Operational | Assertion/note |
|---|---|---|---|
| ð | semantics | pre-/post-condition | |
| ð --r |
X& | Preconditions: there exists s such that r == ++s. Postconditions: r is dereferenceable. --(++r) == r. --r == --s implies r == s. addressof(r) == addressof(--r). |
|
| ð r-- |
convertible to const X& | { X tmp = r; --r; return tmp; } | |
| ð *r-- |
reference |
[Note 1:
Bidirectional iterators allow algorithms to move iterators backward as well as forward.
â end note]