D
Derek
#include <deque>
#include <iostream>
using namespace std;
int main()
{
deque<int> foo;
foo.push_back(42);
deque<int>::reverse_iterator it = foo.rbegin();
while (it != foo.rend())
{
cout << "start of loop\n";
int temp = *it++;
foo.pop_back();
}
return 0;
}
When compiled with GCC 3.3.1, the program above prints
"start of loop" once and exits gracefully (as I would
expect it to do).
When compiled with MSVC 6 (SP6), it displays "start of
loop" twice and crashes.
Who is right?
#include <iostream>
using namespace std;
int main()
{
deque<int> foo;
foo.push_back(42);
deque<int>::reverse_iterator it = foo.rbegin();
while (it != foo.rend())
{
cout << "start of loop\n";
int temp = *it++;
foo.pop_back();
}
return 0;
}
When compiled with GCC 3.3.1, the program above prints
"start of loop" once and exits gracefully (as I would
expect it to do).
When compiled with MSVC 6 (SP6), it displays "start of
loop" twice and crashes.
Who is right?