Re: How does STL map deal with scoping and memory persistance
- From: "Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx>
- Date: Tue, 19 Jul 2005 11:51:13 +0100
Tommo wrote:
Being that I am holding pointers ( that have been new'd elsewhere ) when i want to remove elements from this map, should i be deleting the value under a key or will the container take are of it for me??
If you allocated the memory, you need to take care of destroying it (unless you've explicitly passed on the responsibility for deleting it, e.g. to a smart pointer). The map only takes care of memory and objects it allocates. So, you should be deleting the value or, ideally, you should be using a smart pointer rather than a raw pointer.
Tom .
- References:
- How does STL map deal with scoping and memory persistance
- From: Tommo
- Re: How does STL map deal with scoping and memory persistance
- From: Carl Daniel [VC++ MVP]
- Re: How does STL map deal with scoping and memory persistance
- From: Tommo
- How does STL map deal with scoping and memory persistance
- Prev by Date: Re: exporting classes in a DLL
- Next by Date: Re: exporting classes in a DLL
- Previous by thread: Re: How does STL map deal with scoping and memory persistance
- Next by thread: Re: How does STL map deal with scoping and memory persistance
- Index(es):
Relevant Pages
|