Boost logo

Boost Users :

Subject: [Boost-users] Map Binary archive problem May be a bug?
From: Joshua Nocturne (joshuanocturne_at_[hidden])
Date: 2014-10-23 21:32:55


On my phone, so I try my best to describe my problem.
std::map<int,int> myMap;
for(int i = 0; i != 30; i++)
    myMap.insert( make_pair(i,i+1) );

ofstream ofs(&quot;test&quot;);
binary_oarchive oa(ofs);
oa<<myMap;
ofs.close();
ofs.clear();
myMap.clear();

Ifstream ifs(&quot;test&quot;);
binary_iarchive ia(ifs);
ia>>myMap;

This code will throw an exception &quot;input stream error&quot;.
But if reducing the size of map like this
for(int i = 0;i != 20; i++)
It will run successful. Cause I can't figure it out so I seek your help.
Look forward to your reply.



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