Re: Dynamic Memory question


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by John Kugelman on April 20, 2001 at 04:30:56:

In Reply to: Dynamic Memory question posted by David Shell on April 19, 2001 at 23:33:24:

The STL containers just store copies of the parameter type; they don't know anything about dynamic allocation or construction.

We're supposed to store pointers in the lists; the STL containers don't know anything about what type the pointers point to, and they don't care. When you manipulate the STL containers you're just manipulating pointers, not actual objects.

So the answer is, do it yourself. Create them dynamically with new, store the pointers in the containers, and then delete the pointers before the containers are destroyed.




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]