A
Andy
Hi,
I am trying to get the iterator that points to the last element of a
deque.
However, the following program is incorrect:
#include <deque>
#include <iostream>
using namespace std;
int main()
{
deque<int> queue;
deque<int>::iterator it;
queue.clear();
queue.push_back(5);
it = queue.rbegin().base();
cout<<"*it = "<<*it<<endl;
return 0;
}
How can I get a correct one?
Thanks a lot!
Andy
I am trying to get the iterator that points to the last element of a
deque.
However, the following program is incorrect:
#include <deque>
#include <iostream>
using namespace std;
int main()
{
deque<int> queue;
deque<int>::iterator it;
queue.clear();
queue.push_back(5);
it = queue.rbegin().base();
cout<<"*it = "<<*it<<endl;
return 0;
}
How can I get a correct one?
Thanks a lot!
Andy