Skip to main content
GameDev.net gamedev.net
🔒 Locked

boost::shared_ptr question

Started by Sir Sapo Aug 20, 2006 at 2:37 AM 1 replies 1.9k views
Original Post
Sir Sapo
Sir Sapo
Hey everyone, Just a quick question about using shared pointers. If I reassign a shared_ptr point to something else, and the reference count of the previously pointed to object is 0, will the shared_ptr automatically delete the old pointer when the shared_ptr is reassigned somewhere else? Sorry if that's unclear...
My Current Project Angels 22 (4E5)
_goat
_goat
When the last shared_ptr to a bunch of memory is either destroyed or realigned, the reference count drops from 1 to 0 (I believe), and the memory is deallocated. It is a fairly typical shared pointer way of handling things.
Sir Sapo
Sir Sapo
Thanks, just checking.

rate++ for the quick response!
My Current Project Angels 22 (4E5)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.