I don't know is this is a bug as such, but thought I should bring it up.
I boiled down an un handled exception I was receiving in VC 7.1 and
related it to the demo.cpp
The demo does not close or flush the ofstream before it reads back from
the same file it wrote to, this appears to work correctly for the demo,
but in the attached very simple case it does not. I am assuming that it
is because the ofstream did not get flushed and the file contains no
data.
I think that adding a flush or close would make the demo more robust and
complete.
int _tmain(int argc, _TCHAR* argv[])
{
std::string filename(boost::archive::tmpdir());
filename += "/demofile.txt";
std::string b1("mike");
std::ofstream ofs(filename.c_str());
boost::archive::text_oarchive oa(ofs);
oa << b1;
// FIX
ofs.flush();
ofs.close(); // Without either of these VC7.1 gives
// Unhandled exception at 0x77e738b2 in
bstTest.exe: Microsoft C++ exception: //
boost::archive::archive_exception @ 0x0012f7bc. "
// END FIX
std::string b3;
std::ifstream ifs(filename.c_str());
boost::archive::text_iarchive ia(ifs);
ia >> b3;
}
Call stack ->
bstTest.exe!boost::throw_exceptionboost::archive::archive_exception(co
nst boost::archive::archive_exception & e={...}) Line 40 C++
bstTest.exe!boost::archive::detail::common_iarchive