I'm trying to use an iterator to loop through a vector of pointers to my class CEntity and call their Update() method. This is my first time using an iterator and I hit a problem.
1 2 3 4 5
for (std::vector<CEntity*>::iterator iter = m_entityVector.begin(); iter!=m_entityVector.end(); iter++)
{
iter->Update(); // invalid return type 'CEntity **' for overloaded 'operator ->'
//'Update' : is not a member of 'std::_Vector_iterator<_Ty,_Alloc>'
}
my m_entityVector is a vector of entities, CEntity contains a virtual update method which will be overloaded by children