"Bob Hairgrove" <wouldnt_you_like@to_know.com> wrote in message
news:5i********************************@4ax.com...
[SNIP]
If you allocate memory for an object with "new" and store a pointer to
that object in an STL container, you need to ensure that you call
"delete" on every pointer before the container is cleared.
This is not necessarily true. The standard library containers also create
copies of pointers and it depends very much what you want to achieve whether
a delete statement should/must be issued before the container is cleared.
Imagine for example a container of pointers to geometric primitives and
another container where you store the pointers to the subset of the
primitives that have been selected. If you called a delete statement on the
pointers in the selection container then youŽd send all those primitives
into nirvana which is certainly not what you normally would want.
Cheers
Chris