[serialization - newbie] serializing multiple objects in one archive
Hi, I've to serialize and deserialize multiple objects. Can I serialize them in one archive and deserialize from the same correctly? Say something like following is my save/restore function: void save(boost::archive::binary_oarchive &archive) { string version = tool.getversion(); MyData *data = MyData::instance(); MyDifferentData *differentData = MyDifferentData::instance(); if (data && differentData) { archive << version; archive << data; archive << differentData; } } void restore(boost::archive::binary_iarchive &archive) { string version = tool.getversion(); string serializedToolversion; MyData::cleanup(); MyDifferentData::cleanup(); archive >> serializedToolVersion; if (version == serializedToolVersion) { archive >> (MyData *) MyData::instance(); archive >> (MyDifferentData *) MyDifferentData::instance(); } } Or do I need to serialize each of these into different archives? Regards, ~ Soumen -- View this message in context: http://www.nabble.com/-serialization---newbie--serializing-multiple-objects-... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (1)
-
Soumen