for(list<int>::iterator walker = numList.begin(); walker != numList.end(); walker++)
iterator error
Hi all,
this is my code:
and this is my error:
62 C:\WINDOWS\Desktop\Joshua\Tutorials\STL_Lists_Cpp\STL - Lists\main.cpp using obsolete binding at `walker'
I am using dev-c++ 4.9.9.0
Nayone knows what's wrong?
Joshua
[Edited by - Joshnathan on November 24, 2004 10:44:21 AM]
What headers did you include?
How is numList defined?
Have you tried ++walker rather than walker++?
By the way, it's not called a "walker", but an "iterator". [smile]
How is numList defined?
Have you tried ++walker rather than walker++?
By the way, it's not called a "walker", but an "iterator". [smile]
IIRC, that error usually only happens when you declare a variable in a for loop (or something similar) and then reference the variable after the loop is finished. It might help if you changed your loop like:
This will keep the variable alive past the end of the for loop.
list<int>::iterator walker;for(walker = numList.begin(); walker != numList.end(); walker++)
This will keep the variable alive past the end of the for loop.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement