Re: [Boost-users] Re: (de)serializing vector<const A*>
Dear Robert
Thank you for answering.
I am sorry I was not very specific (though please don't think I would put the
question without RTFM first ;) )
The part of documentation you pointed to told me to do const_cast manually. It is fine
in case of const members of a class, but this time the const type is contained by a vector.
I could manually write the serialization code for my vector
Look in the documentation under Reference/Class Serialization/const members
Robert Ramey
Zoltan Szatmary wrote:
Hello
could you help please? what is the easiest way to (de)serialize a member of type vector
(A being a base class)? Serializing is fine, but deserialization fails to compile since the vector deserialization code tries to deserialize a const A* pointer without const_cast-ing it (I guess). Thank you in advance
Zoltan
OK, I've looked at this more carefully and see no obvious fix.
My original intention was that serialization of a const object would
generate a compile error unless explicitly overridden. I your case this
isn't easy as the override would be inside the implementation of
serialization of collections. Fixing it here would conflict with my
original intent and permit un noticed alteration of const members.
I'll have to think about this some more.
As to your particular case, I did try variations on:
template<class Archive>
inline void load(
Archive & ar,
std::vector
Dear Robert
I could manually write the serialization code for my vector
type but I hoped I could use the built-in vector serialization templates in vector.hpp To be clear I copy here the piece of code I am talking about
participants (2)
-
Robert Ramey
-
Zoltan Szatmary