Context: I'm trying to write a resource/content manager. When content is loaded, a class describing the resource and holding the unmanaged data is allocated and passed back to the caller. A feature I would like to have for this manager is the ability to reload assets during the runtime of the program. At this point however, the reference to the resource has likely been shared across various parts of the program, and as per my understanding, creating a new resource and assigning an old reference will simply change the reference of that specific variable to the new resource and leave the rest unchanged.
My question is thus: how to I create a new instance of the class, and copy into the memory block where the previous resource is located? Or, what I presume to be the real question here: how do I get around not being able to do this? (I assume due to the arbitrary nature of the pointers, that having different data, especially of different size would not work regardless, but I don't know, and can't find answers elsewhere.)
Speculation (feel free to skip): My first guess as to a solution to the second question is passing around references to the content manager itself with an identifier, but that seems rather unwieldy, having to pass around multiple references in the place of one. Another solution would be having an event system trigger on reload, but having every class that uses these resources having to manage this event also seems like a bad idea.
If more context is required for anyone who may be able to answer, please leave a comment, thank you.