Re: How to serialize reference members using boost::serialization
Thank you for your replies.
Here is an example that I had prepared for working with references
(and you can see how const is handled without const_cast<>) -
http://www.codeguru.com/forum/showthread.php?t=415510
It works but I must say that I don't feel I am handling the reference
member correctly. Because the boost documentation says that references
should be serialized as pointers but I don't think I am doing that.
From my code it simply looks like any other member. When I try to
make_nvp for the member by pointer, I start getting long compiler
errors. Moreover, if we do that via pointer, I am not clear on few
things:
1. Who allocates memory that the deserialized pointer will point
to?
2. Will it be my responsibility to clean it?
3. What if that object is shared across multiple other serialized
objects which have references to it? How does the user code change?
Can anyone give a definitive answer please (or explain the changes
that I should make to the above mentioned code, if any)? I have
searched boost test archives and a lot of email threads but haven't
found an example to be very sure about reference handling.
I must say this as well, that boost serialization library
documentation is very poor and should have had covered these points in
detail! :(
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]