Ошибка в void DestroyBodies(vector & bodies)

Рейтинг: 0Ответов: 1Опубликовано: 09.05.2011
void DestroyBodies(vector<CBody*> & bodies)
{

    for (vector<CBody>::iterator it = bodies.begin(); it != bodies.end(); ++it)
    {
        delete *it;
        *it = NULL;
    }
}

Что мне делать? Выводит ошибки

  • error C2259: 'CBody' : cannot instantiate abstract class (похоже в этом вся проблема)

и соответственно:

  • error C2440: 'initializing' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'std::_Vector_iterator<_Ty,_Alloc>'
  • error C2679: binary '!=' : no operator found which takes a right-hand operand of type 'std::_Vector_iterator<_Ty,_Alloc>' (or there is no acceptable conversion)
  • error C2440: 'delete' : cannot convert from 'CBody' to 'void *'

Ответы

▲ 2Принят

В цикле for пропущен * в vector<CBody>::iterator. Но, предполагаю, проблема не в этом. Выложите код класса CBody.