Boost logo

Boost Users :

From: Filip Peters (filippeters_at_[hidden])
Date: 2008-04-02 17:13:23


I just tried serializing a simple vector,
std::vector<unsigned int> vectortest;

If I serialize out in 1.34, I can't read it in in 1.35.
xml result from 1.35:
<vectortest>
    <count>3</count>
    <item>1</item>
    <item>2</item>
    <item>3</item>
</vectortest>

from 1.34:
<vectortest>
    <count>3</count>
    <item_version>0</item_version>
    <item>1</item>
    <item>2</item>
    <item>3</item>
</vectortest>

Notice the item_version, this causes an exception when reading it in with 1.35....
I need a way to get the behavior from 1.34 back....
Otherwise my files aren't readable anymore.

small testprogram:

#include <boost/config.hpp>

#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
//#include <boost/archive/binary_iarchive.hpp>
//#include <boost/archive/binary_oarchive.hpp>

#include <boost/serialization/vector.hpp>
#include <boost/serialization/export.hpp>

#include <fstream>
#include <iomanip>

int _tmain(int argc, _TCHAR* argv[])
{

    std::vector<unsigned int> testvector;
    testvector.push_back(1.);
    testvector.push_back(2.);
    testvector.push_back(3.);

//this in 1.34
        std::ofstream ofs( "testing2.txt", std::ios::binary ) ;
         boost::archive::xml_oarchive oa(ofs);
        oa << boost::serialization::make_nvp("vectortest", testvector);
        ofs.close();

//do this in 1.35
    try{
        std::ifstream ofs( "testing2.txt", std::ios::binary ) ;
         boost::archive::xml_iarchive ia(ofs);
         ia >> boost::serialization::make_nvp("vectortest", testvector2);
        ofs.close();
    }
    catch(boost::archive::archive_exception testexception){
    //reading a file from 1.34, will end up here
        std::string error = testexception.what();
    }

return 0;
}

      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com



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