Here is the code for my destructor for the class MyClass
~MyClass() { for ( std::vector< MyStruct* >::const_iterator ci = elements.begin(); ci != clients.end(); ++ci ) { delete *ci; } clients.clear(); } I use const_iterator , everything compiles and works. Or maybe you need to use an iterator . Still, the const_iterator says that we will not change the object to which it points, and we delete it - is it essentially a change, or am I wrong? It is true that I use const_iterator