Rob Lawless wrote:
> maybe this is a dumb question
> but say i have either a vector or pointers or a vector of references of=
=20
> some object
> if i run through the vector using an iterator & erase a certain element=
=20
> in the vector specified by the iterator using the erase method in=20
> vector, is the destructor for the object that is pointed/referenced=20
> called & thus the object no long exists or is only that particular=20
> reference/pointer in the vector erased ?
> any help greatly aprreciated
> regards
> rob
Storing references in a vector is not possible. You can only store=20
pointers, or whole objects. The vector doesn't care about what you=20
store, it will make copies of it, whenever you insert something into it.=20
If you store pointers, only the pointer is copied.
Because the vector doesn't know what you store, it cannot call delete on=20
the stored objects, so you have to do it manually yourself.
--
Greetings,
Bal=E1zs
|