By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,101 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,101 IT Pros & Developers. It's quick & easy.

interator check

P: 4
Hi, I'm new to this interator thing.
Can I check if a interator != NULL.
It gives an compiling error on VC8, but not VC6.
Please assist.
Aug 7 '07 #1
Share this Question
Share on Google+
5 Replies


gpraghuram
Expert 100+
P: 1,275
Hi, I'm new to this interator thing.
Can I check if a interator != NULL.
It gives an compiling error on VC8, but not VC6.
Please assist.
r u discussing about iterator.
I havent heard anything like iterator

Raghuram
Aug 7 '07 #2

P: 4
Yes, sorry iterator. Just trying to get they app to compile on the new compiler and don't want to remove code completely. Any way of checking if the iterator is NULL?
Aug 7 '07 #3

Meetee
Expert Mod 100+
P: 931
Yes, sorry iterator. Just trying to get they app to compile on the new compiler and don't want to remove code completely. Any way of checking if the iterator is NULL?
I think you have taken iterator as a variable and then trying to compile this. Can you paste your code snippet here? Also paste errors if getting any.

Regards
Aug 7 '07 #4

P: 4
Just a quick sample:

int main()
{
NumberedFieldMap::iterator m_CurrentField;

if ( m_CurrentField != NULL )
{
cout << "m_CurrentField not is NULL" << endl;
}
else
{
cout << "m_CurrentField is NULL" << endl;
}
char c = getch();
return 0;
}

I'm not getting any errors as I'm using VC6, but the guy asking me to look at it is using VC8. Something about no conversion for left hand operator. Cant exactly remember the error.(should have written it down) Maybe someone here came accross the same problem.
Aug 7 '07 #5

P: 4
All I actually want to know is can I check if a iterator is NULL. Or is the end() function enough. What if it's trying to get an value out of the scoupe? This is critical code so, I don't want to take any chances.
Aug 7 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.