std::Bidirectional Iterator
<iterator>
Bidirectional iterator category
Bidirectional iterators are iterators especially designed for sequential access in both directions - towards the end and towards the beginning.
There is not a single type of
bidirectional iterator: Each container defines its own specific iterator type able to iterate through it and access its elements. But all
bidirectional iterators support -at least- the following operations:
| characteristic | valid expressions |
| Can be default-constructed | X a;
X() |
| Can be copied and copy-constructed | X b(a);
b = a; |
Accepts equality/inequality comparisons.
Equal iterators imply the same element is pointed | a == b
a != b |
| Can be dereferenced (when not null) | *a
a->m |
| Can be incremented (when not null) | ++a
a++
*a++ |
| Can be decremented (when not null) | --a
a--
*a-- |
Where
X is an iterator type, and
a and
b are objects of this iterator type.
These characteristics are the same of
forward iterators, except that bidirectional iterators also support the decrement operator.
See also
- Input Iterator
- Input iterator category
- Output Iterator
- Output iterator category
- Forward Iterator
- Forward iterator category
- Random Access Iterator
- Random-access iterator category
- iterator
- Iterator base class (class template
)