Max, VS2005 uses checked iterators. The additional checking prevents many misuses of STL containers.
list<int> alist; alist.push_back(1);
list<int>::iterator it_NULL; // denotes a NULL iterator list<int>::iterator it_beg = alist.begin();
std::cout << boolalpha; std::cout << "(it_NULL == it_beg) " << (it_NULL == it_beg) << endl;
Here it_begin is an iterator to the alist container, and it_NULL is an iterator that does not have an associated container. Since the iterators point to different containers, they cannot be compared. This is a good thing :-)
What's wrong? Or any other alternative solution available? Thanks in advance for any help.
The checked iterators kept you from doing something that you shouldn't be doing. You can turn off checked iterators by throwing some defines during compilation (I think any third-party libs that you link to would have to throw the same defines). Trust me when I say that you do not want to turn checked iterators off. It is quite embarrassing how many times checked iterators have found silly bugs in my code :-) I would suggest coming up with a different construct to test for NULL. Justin