Doesn't that defeat the purpose of a shared_ptr though?
That's an excellent question. If you want an object to exist after the last reference to it has gone away, then it doesn't sound like shared_ptr is the type to be using for it.
I guess I could always create my own class, or even just add a counter directly into the image class. shared_ptr seems to be a class of quite low weight complexity, so it wouldn't be hard to reproduce it.
I guess I could always create my own class, or even just add a counter directly into the image class. shared_ptr seems to be a class of quite low weight complexity, so it wouldn't be hard to reproduce.
What about auto_ptr? I believe it has a release member function that basically releases the memory from automatic destruction. You could carry it around in the auto_ptr until you hand it off, "release it," to the SDL system for management.