std::vector<Enemy*>::iterator it;
for(it;it!=tracked.end();it++){
(*it)->update(timeSinceLastFrame);
}
tracked is the vector:
std::vector<Enemy*>
Why am I getting this error? (please say if I haven’t included enough details)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You never initialized the iterator.
Many implementations (such as VC++, which you appear to be using) perform checks in debug to make sure that when two iterators are compared, they belong to the same object. A default constructed iterator does not belong to any particular instance, and as such the
it != tracked.end()check will fail with that error.