You don't want to do that -- the container (ObjectList, in your case) owns the items it contains, so to delete them, you need to tell it what you want, as in: ObjectList.erase(item);
. Since you're (apparently) deleting all the items, you might as well use: ObjectList.clear();
and skip using your explicit loop at all.
Then again, since ObjectList is apparently an std::list, you don't need to do any of the above -- when you destroy an std::list, it automatically destroys whatever objects it contains.
Edit: (mostly in response to UncleBens' comment): If you're trying to create a container of pointers that manages deleting the items pointed to by the pointers it contains, then the first thing you want to do is ensure that it really contains pointers:
template <class T>
class container {
typedef typename std::list<T>::iterator it;
std::list<T *> items; // Note 'T *' rather than just "T"
public:
~container() {
for (it p=items.begin; it!=items.end(); ++it)
delete *it; // *it yields a pointer from the container.
}
};