Subject: [Boost-bugs] [Boost C++ Libraries] #1774: serialization: file written with 1.34.1 can't be read in with 1.35
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-04 18:15:41
#1774: serialization: file written with 1.34.1 can't be read in with 1.35
-----------------------------------+----------------------------------------
Reporter: filippeters_at_[hidden] | Owner: ramey
Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.35.0 | Severity: Showstopper
Keywords: |
-----------------------------------+----------------------------------------
std::vectors of basic types, saved with 1.34.1, can't be read by 1.35:
simple sample, write file with 1.34.1:
std::vector<unsigned int> vectorToSave;
vectorToSave.push_back(0);
vectorToSave.push_back(1);
vectorToSave.push_back(2);
std::string filename("C:\\test1341.xml");
{
std::ofstream ofs(filename.c_str());
assert(ofs.good());
boost::archive::xml_oarchive oa(ofs);
oa << BOOST_SERIALIZATION_NVP(vectorToSave);
}
And with 1.35:
std::vector<unsigned int> vectorToLoad;
std::string oldfilename("C:\\test1341.xml");
try{
std::ifstream ifs(oldfilename.c_str());
assert(ifs.good());
boost::archive::xml_iarchive ia(ifs);
// restore the schedule from the archive
ia >> BOOST_SERIALIZATION_NVP(vectorToLoad);
}
catch(...){
std::cout << "\nproblem";
}
This will end up in the catch.
sample output from 1.34:[[BR]]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="4">
<vectorToSave>
<count>2</count>
== <item_version>0</item_version> ==
<item>0</item>
<item>1</item>
</vectorToSave>
</boost_serialization>
sample output from 1.35:[[BR]]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="4">
<vectorToSave>
<count>2</count>
<item>0</item>
<item>1</item>
</vectorToSave>
</boost_serialization>
Notice the missing <item_version>0</item_version>
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1774>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC