Jump to content
  • Advertisement
Sign in to follow this  
ZMaster

Smart Pointer Design

This topic is 4489 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. I'm looking for a design of a special smart pointer implementation with C++. Either existing concepts or new ideas may be named. Unlike other garbage collected designs, this one should be forced to unload an object from memory by using the delete keyword. The 'smart' part of the pointer should then make all other pointer instances point to NULL instead of some invalid memory area: Assume an object O residing on the heap and three pointer instances P1, P2, P3, each pointing to O. A call to delete P3 should now make P1 and P2 point to NULL. Note that by default, they would still point to O, but the memory there has become invalid and might be overwritten soon, if not already. Any idea or suggestion would be great! Thanks in advance. ZMaster

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Palidine
a run of the mill weak pointer fits your description.


Great. Thanks. This is exactly what I was looking for.
However, I would also like to understand the logic behind this approach. Can you describe this in an understandable way? ;-)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!