Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-01-19 12:20:02


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<const A *> &t,
const unsigned int /* file_version */
){
ar >> reinterpret_cast<vector<A *> >(t);
}

but wasn't successful. So for now the best I can suggest is to re-implement
the serializaton for your particular vector.

Robert Ramey

Zoltan Szatmary wrote:
> Dear Robert

>I could manually write the serialization code
> for my vector<const A*> 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
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net