|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-03-21 00:23:34
One thing that I wonder about here. Binary archives, the stream should be opened with ios::binary. I'm not sure how that works with string stream.
Another difference betwen binary and other archives is the special handling for vectors and arrays. I wouldn't think this should matter here, but it might be looked into. Try thsi:
Robert Ramey
"Jerry" <jerry_at_[hidden]> wrote in message news:1b7001c88af9$2cfc4840$0565a8c0_at_p424...
Using Boost 1.34.1 with VC++ 7.1 SP1
I have existing code which serializes/de-serializes correctly to boost::archive::xml_oarchive
Within the same .cpp file I'm trying to serialize instances of the same hierarchy to boost::archive::binary_oarchive using this code:
// ultimate sink for serialized data
std::ostringstream os;
// binary format is OK as it is going onto the clipboard
boost::archive::binary_oarchive oa(os);
// temp storage
std::vector<CDiagramEntity*> vec;
// only serialize selected items
for (std::vector<CDiagramEntity*>::iterator it = m_entities.begin();
it != m_entities.end();
++it)
{
if ((*it)->IsSelected())
// instead of this:
// vec.push_back((*it));
try this:
oa & make_nvp("it", *it);
}
// just serialize the selected item vector (*)
oa & BOOST_SERIALIZATION_NVP(vec);
* - This is failing in oserializer.hpp line 417, the relevant code being:
// sice true_type is valid, and this only gets made if the
// pointer oserializer object has been created, this should never
// fail
bpos_ptr = archive_pointer_oserializer<Archive>::find(* true_type);
assert(NULL != bpos_ptr); // <------------------ this assert triggered.
I note the confident comment above find(). Can anyone help here?
Many thanks
Jerry
------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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