Print the contents in reverse order using reverse_iterator and functions rbegin() and rend() : deque iterator « deque « C++ Tutorial






#include <deque>
#include <iostream>

using namespace std;
typedef deque<int> INTDEQUE;

int main(void)
{
   INTDEQUE A;
   A.push_back(1);
   A.push_back(2);
   A.push_back(3);
   A.push_back(4);
   A.push_back(5);

   INTDEQUE::reverse_iterator rpi;
   for(rpi = A.rbegin(); rpi != A.rend(); rpi++)
      cout << *rpi << " ";
   cout<< endl;
}








22.6.deque iterator
22.6.1.Define iterator for deque
22.6.2.deque::iterator and deque::reverse_iterator
22.6.3.Using the Front of a Deque
22.6.4.Use iterator and reverse_iterator with deque
22.6.5.Print the contents in reverse order using reverse_iterator and functions rbegin() and rend()
22.6.6.Create an empty deque and then assign it a sequence that is the reverse of deque
22.6.7.Use insert iterator adaptors to insert one deque into another by way of the copy() algorithm.