Use Reverse Iterator Adapters to Iterate Backward
Explore how to implement and use reverse iterator adapters to traverse C++ STL containers backward. Understand bidirectional iterators and adapt iteration techniques for both STL containers and primitive arrays to print elements in reverse order.
We'll cover the following...
We'll cover the following...
A reverse iterator adapter is an abstraction that reverses the direction of an iterator class. It requires a
How to do it
Most bidirectional containers in the STL include a reverse iterator adapter. Other containers, such as the primitive C-array, do not. Let’s look at some examples:
Let’s start with the ...