Does calling ~myclass() (destructor) deletes the object?

Started by
29 comments, last by Zipster 8 years, 6 months ago

I'm with the others who have suggested you should re-think your approach to texture management.

Your texture class should really be non-copyable, as that's almost never what you want to do. Rather, you should have a single instance of the texture object being managed centrally elsewhere, and only let others hold pointers or handles (which themselves can be copyable and otherwise behave as value types). std::shared_ptr and std::weak_ptr are particularly well-suited to this task.

If a texture resource ever needs to be copied, it should either have a dedicated clone() method, or delegate the task to the texture asset manager. It shouldn't be something that can be easily done accidentally.

This topic is closed to new replies.

Advertisement