serialization: loading std::map replaces existing map data objects
I was kinda hoping I could construct a std::map with default data
objects, then use serialization to overwrite some of the their member
variables. Unfortunately serialization completely replaces the map's
data objects. I see in 'collections_load_imp.hpp' what I presume is
code to do what I want but it is commented out:
template
the copy_collection was an experiment on work has been suspended and
probably not be implemented, and if it were implemented, would be
implemented differently in anycase.
There is no reason you have to use the default serialization implementation
that I have provided. Your are totally free to make your own and use
that instead. There are a couple of ways to do this.
a) Just don't included boost/serialization/map.hpp. Make your
own version and use it instead. This is probably not real appealing
as it would replace the implementation for ALL the maps.
b) Just specify a serialize function for the particular map you are using.
e.g.
template<class Archive>
void serialize(Archive & ar, std::map
I was kinda hoping I could construct a std::map with default data objects, then use serialization to overwrite some of the their member variables. Unfortunately serialization completely replaces the map's data objects. I see in 'collections_load_imp.hpp' what I presume is code to do what I want but it is commented out:
template
inline void load_collection(Archive & ar, Container &s){ // if(0 != (ar.get_flags() & boost::archive::no_object_creation)) // copy_collection (ar, s); // else rebuild_collection (ar, s); Is there any chance that copy_collection will work one day, or has it been abandoned?
--- Peter Whaite.
participants (2)
-
Peter Whaite
-
Robert Ramey