Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Kyle N

Deleting a dynamic array of std::lists

This topic is 5451 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, Small problem, this may be a stupid question - rough hangover , if I create a dynamic array where each element is a std::list as such: std::list *pFreeList = new std::list[10]; How do I delete each std::list element of the array? Thanks Kyle

Share this post


Link to post
Share on other sites
Advertisement
When deleting your array, just cycle through it and clear each list explicitly before deleting the array elements with delete [], should work.

-fel

Share this post


Link to post
Share on other sites
D''oh..! Thought it was something std::list specific that wouldn''t allow delete[] to work, turns out it was a typo..! Took long enough to spot :/

Thanks guys
Kyle

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!