Re: Simple iterator problem
Rajib <rajibeq@verizon.net> wrote:
Daniel T. wrote:
"saneman" <asdff@asd.com> wrote:
I have made the following code:
std::vector<int> v;
std::vector<int>::iterator it;
v.push_back(0);
v.push_back(0);
v.push_back(0);
v.push_back(1);
v.push_back(1);
v.push_back(1);
it = v.begin();
while (it != v.end()) {
std::cout << *it << std::endl;
it++;
}
It compiles fine (using MS VS 2008) and when I run it it also
prints 0 0 0 1 1 1. But then I get:
Debug Error!
Invalid allocation size 492.....bytes
and I need to pres either abort, try again or ignore. Is this a
windows specific issue?
What is the code that comes after this block?
It could also be code before that block that is causing the problem.
:-) It could be code half-way across the program! But we have to start
somewhere, don't we. The point is, the OP didn't post the code that has
the problem...