Thanks for the comments!
I believe that the split member approach as used in your example would be a workable solution to my problem.
Ideally though it would be nice if, by some C++ magic, one could tell Boost serialization that pointers to this particular class require special handling (i.e. using the map to get the unique id) and then serialize them as normal in the serialize template. That way not all users of the framework of my program would need to know deeper details of the serialization strategy.
-----Original Message-----
From: kila suelika via Boost-users
If a serialized object in the dynamic part contains a pointer to a non-seralized object in the static part then how do I deal with that. Clearly the address cannot be serialized since it may change between builds and even between runs (ASLR). The program does contain a 'registry' though where all relevant static objects are registered with a unique identifier.
So question is would it somehow be possible to have Boost serialization use this registry to serialize the unique identifier instead of trying to serialize the entire object when one of those pointers are serialized?
Each class can choose exactly what data it serializes and deserializes, and what it does with it. For this case it sounds like you probably want https://www.boost.org/doc/libs/1_80_0/libs/serialization/doc/tutorial.html#s...https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-68159251cabc4e3e&q=1&e=023e668a-5694-4ebd-9e35-0e69caf6a0bf&u=https%3A%2F%2Fwww.boost.org%2Fdoc%2Flibs%2F1_80_0%2Flibs%2Fserialization%2Fdoc%2Ftutorial.html%23splitting such that you can save an internal id and then reload that id and look up the corresponding pointer, rather than serializing the other object directly. You can still cascade into the other object as a reference to save/load its dynamic state after that. You will likely also want to read about https://www.boost.org/doc/libs/1_80_0/libs/serialization/doc/special.html#ob...https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-fdf9101b6c1d5fc8&q=1&e=023e668a-5694-4ebd-9e35-0e69caf6a0bf&u=https%3A%2F%2Fwww.boost.org%2Fdoc%2Flibs%2F1_80_0%2Flibs%2Fserialization%2Fdoc%2Fspecial.html%23objecttracking _______________________________________________ Boost-users mailing list Boost-users@lists.boost.orgmailto:Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-usershttps://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-55bc61b18a08fed2&q=1&e=023e668a-5694-4ebd-9e35-0e69caf6a0bf&u=https%3A%2F%2Flists.boost.org%2Fmailman%2Flistinfo.cgi%2Fboost-users _______________________________________________ Boost-users mailing list mailto:Boost-users@lists.boost.org Boost-users@lists.boost.org https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-55bc61b18a08fed2&q=1&e=023e668a-5694-4ebd-9e35-0e69caf6a0bf&u=https%3A%2F%2Flists.boost.org%2Fmailman%2Flistinfo.cgi%2Fboost-users https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-55bc61b18a08fed2&q=1&e=023e668a-5694-4ebd-9e35-0e69caf6a0bf&u=https%3A%2F%2Flists.boost.org%2Fmailman%2Flistinfo.cgi%2Fboost-users