I’ve got a memory Arena and a container/handle_map Dynamic_Handle_Map mapping to objects backed in the Arena. I want to copy the whole Arena and handle map. The issue is dynamic handle map’s exponential array references the original Arena. I’m not sure how to do this, it feels kind of hacky and bug prone to just add an offset to every internal pointer, specially I intend to add more handle maps backed by this Arena.
So what’s the simplest and safest way of doing this?
It is pretty hacky
If your that desperate, you can try
- deep cloning
- traverse and replace every invalid pointer
- Relative pointers (relative to itself or arena base)
I’m curious, Why even try to do this??