
Robert Ramey a écrit :
Of course, if I replace B const *pc by B *pc, then the code works correctly.What can I do to serialize pointers to const data ?
Regards,
Or you could replace this above with: ar & const_cast<B *>(pc); (or maybe const_cast<B * &>(pc)
I really do not understand why I would have to do that.
But that would override the normal meaning of "const" as applied to a member variable.
In this case, the member variable is not const. It's not like in http://www.boost.org/libs/serialization/doc/serialization.html#const . It's just a non const pointer that refers to a non const class defined elsewhere, but that promise not to modify that class himself.
You really have to ask yourself what you want serialize to include.
Could you please explain this point ? I do not understand what you mean. Best regards, -- Loïc