mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-09-28 03:20:44 +02:00
added paragraph about reverse_iterator.base()
This commit is contained in:
parent
63bb32cbc9
commit
083fc5343e
1 changed files with 17 additions and 1 deletions
|
@ -22,7 +22,7 @@ iterator points to (alternatively, tt(iter->) can be used to reach the members
|
|||
of the object the iterator points to).
|
||||
it() tt(++iter) or tt(iter++) advances the iterator to the next
|
||||
element. The notion of advancing an iterator to the next element is
|
||||
consequently applied: several containers support emi(reversed_iterator) types,
|
||||
consequently applied: several containers support emi(reverse_iterator) types,
|
||||
in which the tt(++iter) operation actually reaches a previous element in a
|
||||
sequence.
|
||||
it() em(Pointer arithmetic) may be used with iterators of containers
|
||||
|
@ -50,6 +50,22 @@ define their own type ti(iterator)). These members are commonly called
|
|||
ti(begin) and ti(end) and (for reversed iterators (type tt(reverse_iterator)))
|
||||
ti(rbegin) and ti(rend).
|
||||
|
||||
hi(iterators: forward <-> reverse)
|
||||
Wherease reverse iterators can be constructed from ordinary (forward)
|
||||
iterators using tt(reverse_iterator) constructors as in:
|
||||
verb(
|
||||
string str;
|
||||
auto revit = string::reverse_iterator{ str.begin() };
|
||||
)
|
||||
the opposite is not accomplished that way. To retrieve the forward
|
||||
iterator corresponding to a reverse iterator, the ti(reverse_iterator.base())
|
||||
member can be used. E.g., to obtain the forward iterator corresponding to
|
||||
tt(revit) use
|
||||
verb(
|
||||
auto forward { revit.base() };
|
||||
)
|
||||
|
||||
|
||||
Standard practice requires hi(iterator: range) iterator ranges to be
|
||||
em(left inclusive). The notation rangeti(left, right) indicates that tt(left)
|
||||
is an iterator pointing to the first element, while tt(right) is an iterator
|
||||
|
|
Loading…
Reference in a new issue