Skip to main content
gamedev.net
🔒 Locked

Boost refcounted smartpointer?

Started by Toolmaker 2 replies 450+ views
Original Post
Toolmaker
Toolmaker
I'm currently using my self-rolled smartpointer class, and I wanna take a look at using a boost smart pointer, so I'm 100% sure I'm no longer have problems. I have alot of memory leaks, which I assume are because of STL(I use MMGR). I tried to work myself out of this, but at this point, I'm no longer sure of my smartpointer class. Which smartpointer class do I need to use in boost, if I want to be able to pass the pointer around, assign multiple instances and have it ref counted? Toolmaker
 
snk_kid
snk_kid
Quote:
Original post by Toolmaker
Which smartpointer class do I need to use in boost, if I want to be able to pass the pointer around, assign multiple instances and have it ref counted?


shared_ptr/array are reference counted, intrusive_ptr are for objects that already have an embedded reference count (like COM objects) and you can hook it upto automatically de/increment the count and release.
Toolmaker
Toolmaker
Thus, I need to use shared_ptr. Thanks snk_kid!
 

Topic Locked

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

Sign in to reply to this topic.