I'm working with Boost::Serialization library in C++. When I want to restore the object, I use the code below:
// ostr is of type std::ostringstream
std::vector<Certificate *> newCRL;
{
std::istringstream ifs(ostr.str());
boost::archive::text_iarchive ia(ifs);
ia >> newCRL;
}
If the ostr is short in length, I can successfully restore my original object, but the problem I have is with long ostr. If ostr is big, exception below is thrown in run-time:
std::length_error: basic_string::resize
I think std::istringstream ifs(ostr.str());
is the source of this exception.
Is there any work around on this, that I can use to reconstruct big objects?