Reversible Container, reverse_bidirectional_iterator, Random Access Iterator, iterator tags, Iterator Overview
reverse_bidirectional_iterator<BidirectionalIterator, T, Reference, Distance>
Categories: iterators, adaptors
Component type: type
template <class T>
void forw(const list <T>& L) {
list<T>::iterator first = L.begin();
list<T>::iterator last = L.end();
while (first != last) cout << *first++ << endl;
}
template <class T>
void rev(const list <T>& L) {
typedef reverse_bidirectional_iterator<list<T>::iterator, T, list<T>::reference_type, list&l t;T>::difference_type> reverse_iterator; [2]
reverse_iterator rfirst(L.end());
reverse_iterator rlast(L.begin());
while (rfirst != rlast) cout << *rfirst++ << endl;
}
In the function
Defined in the standard header iterator, and in the nonstandard backward-compatibility header iterator.h. This class is no longer part of the C++ standard, but it was present in early drafts, and it is retained in this implementation for backward compatibility.
| Parameter | Description | Default |
|---|---|---|
BidirectionalIterator | The base iterator class. Incrementing an object of class | |
T | The reverse iterator's value type. This should always be the same as the base iterator's value type. | |
Reference | The reverse iterator's reference type. This should always be the same as the base iterator's reference type. | T& |
Distance | The reverse iterator's distance type. This should always be the same as the base iterator's distance type. | ptrdiff_t |
Bidirectional Iterator.
The base iterator type (that is, the template parameter
None.
| Member | Where defined | Description |
|---|---|---|
self | reverse_bidirectional_iterator | See below |
