You could make a resource manager class that counts references to the resources loaded.
So, pseudo example
This would load the the texture from the disk ( if the resource does not yet exist, else it would simply increment a reference count )
Then return a state code ( success, error, file_not_found, etc ), and create a reference to the resource.
This would decrement the texture reference, and null the myTex pointer.
This would only free/remove resources with a 0 reference count.
For this to be safe, you will need to implement copy functionality for the resource classes to handle the reference count to insure a valid count at all times. Or you can disable copying, but this may hinder some things you may want to do.
Some of the information I have provided may be inaccurate, as I am running purely off memory. If you would like, I can formulate a short code example to demonstrate what I am proposing.