24 Iterators library [iterators]

24.2 Iterator requirements [iterator.requirements]

24.2.6 Bidirectional iterators [bidirectional.iterators]

A class or pointer type X satisfies the requirements of a bidirectional iterator if, in addition to satisfying the requirements for forward iterators, the following expressions are valid as shown in Table [tab:iterator.bidirectional.requirements].

Table 110 — Bidirectional iterator requirements (in addition to forward iterator)
ExpressionReturn typeOperationalAssertion/note
semanticspre-/post-condition
-- r X& pre: there exists s such that r == ++s.
post: r is dereferenceable.
--(++r) == r.
-- r == -- s implies r == s.
&r == &-- r.
r-- convertible to const X& { X tmp = r;
-- r;
return tmp; }
*r-- reference

Note: Bidirectional iterators allow algorithms to move iterators backward as well as forward.  — end note ]