Is there any way to tell a shared_ptr not to delete the object it's pointing to if the shared_ptr is destroyed and it is the only shared_ptr pointing to that object?
For example: I have a class 'image' containing a shared_ptr object, pointing to the place where the pixel data is stored. But sometimes that data is created to be used by a SDL_Surface in the first place, not by an image object, but is later pointed to from such an object. Thus, it shouldn't be destroyed by such an object either. I have to this point had a flag set in the object to tell if it is responsible for deleting the data or not when it's destroyed. Hm, I should probably use shared_array in this case.
If I set the shared_ptr to point to NULL, will it still keep count of the number of shared_ptr:s pointing to that place and try to delete the object at that position when it's the last shared_ptr being destroyed?