How to delete dynamically allocated objects from a 2d vector

  2d-vector, c++, memory-management

I have some dynamically allocated objects, type class, on 2d vector and at the end of the program I need to free the memory. My question is which variable for object gives us the vector back, so that I can initialize it with the delete operator?

for ( std::vector<std::vector<Enemies*>>::iterator it1 = vec2D.begin(); it1 != vec2D.end(); ++it1 )
{
    for ( std::vector<Enemies*>::iterator it2 = (*it1).begin(); it2 != (*it1).end(); ++ it2 )
    {
        delete [] 
    }
}

Source: Windows Questions C++

LEAVE A COMMENT