Problem with pointers

Hi

I have no idea how to check if an object gets more pointers attached to the same object.

I am gonna make an image class which will hold a pointer to SDL_Surface, say img, which then holds an image file through IMG_LOAD(filename);

When the image object gets more pointers say through:

img = IMG_Load(frog);
frog = img;

The problem is I have no idea how to check from within this class image how many points at the same image object.

I need to make the class count up/down automatically instead of calling SDL_FreeSurface() and sort.

Hope I made myself clear to what i need help with =/

Thanks
What you need is exactly a boost::shared_ptr. shared_ptr is a reference counted pointer.
Topic archived. No new replies allowed.