A
AbrahamLincolnIllinois
Hi all.
I have a list of pointers to a complicated object. When I erase() a
member of that list, the little blob of memory that contains the
pointer is deleted, I think. But the object pointed to is not
deleted, true? It is not an auto_ptr or any kind of wrapped
pointer.
Further, I assume that the iterator I am holding is no longer valid
once I delete the element. I can't safely erase the member first,
then delete the object through the iterator. So the sequence ought to
be: 1. Delete the object. 2. Erase the list element.
I am checking my understanding, because the code I am working on,
which I inherited, doesn't delete the object at all, either before or
after the element is erased.
Abraham
I have a list of pointers to a complicated object. When I erase() a
member of that list, the little blob of memory that contains the
pointer is deleted, I think. But the object pointed to is not
deleted, true? It is not an auto_ptr or any kind of wrapped
pointer.
Further, I assume that the iterator I am holding is no longer valid
once I delete the element. I can't safely erase the member first,
then delete the object through the iterator. So the sequence ought to
be: 1. Delete the object. 2. Erase the list element.
I am checking my understanding, because the code I am working on,
which I inherited, doesn't delete the object at all, either before or
after the element is erased.
Abraham