I am trying to create a pacman game watching tutorials. So when the ghost is in weak state and the pacman collides with the ghost i am getting the error Vector iterator not incrementable. Can anyone please solve this. Thanks in advance. 

```
for (Ghost*ghost : m_ghosts)
{
    if (ghost->getCollisionBox().intersects(m_pcMan->getCollisionBox()))
    {
        if (ghost->isWeak())
        {
            m_ghosts.erase(std::find(m_ghosts.begin(), m_ghosts.end(),ghost));
            m_score += 100;
        }
        else                
            m_pcMan->die();
    }
}

```