Why is this condition true?

1
2
3
4
5
6
7
8
9
10
short id = 1;
std::vector<short>::const_iterator i = ign.begin();

if ((ign.size() > 0) && (*i == id))
{
	if (i != ign.end())
	{
		i++;
	}
}


On this line:

 
	if (i != ign.end())


The size of ign is 1 (at the point that I'm debugging) and i is also 1, yet it steps into the condition anyway and increments i, causing overflow errors later. I'm really just looking for a way to say "if the iterator isn't pointing to the final element in the vector". Any help would be appreciated.
end() is not the last element in the container, it's one passed the last element of the container. begin() will only == end() if the container is empty.
Ah, thanks for the help.
Topic archived. No new replies allowed.