im having bit of trouble trying figure out why piece of code crash when start function returns 0;
i suspect when returns start function calls destructors xml_iarchive , failing inside there.
do have call flush or function clean before xml_iarchive calls destructors.
i have no idea, :)
// serialize class filelayout { private: std::string m_name; int m_datetime; std::string m_version; std::string m_clientpath; int m_length; public: filelayout() { }; filelayout(std::string name ,int datetime, std::string version, std::string clientpath, int length) { m_name = name; m_datetime = datetime; m_version = version; m_clientpath = clientpath; m_length = length; }; // allow serialization access non-public data members. friend class boost::serialization::access; template<typename archive> void serialize(archive& ar, const unsigned version) { ar & boost::serialization::make_nvp("name", m_name); ar & boost::serialization::make_nvp("datetime", m_datetime); ar & boost::serialization::make_nvp("version", m_version); ar & boost::serialization::make_nvp("clientpath", m_clientpath); ar & boost::serialization::make_nvp("length", m_length); } // std::string name() { return m_name; }; int datetime() { return m_datetime; }; std::string version() { return m_version; }; std::string clientpath() { return m_clientpath; }; int length() { return m_length; }; }; int start(std::string &data) // xml { // set filesize // set name boost::iostreams::basic_array_source<char> device(data.c_str(), data.size()); boost::iostreams::stream<boost::iostreams::basic_array_source<char> > s(device); boost::archive::xml_iarchive ia(s,boost::archive::no_header); ia >> boost_serialization_nvp(filelayout); data.clear(); return 0; // fails here }
turns out problem packing, spent whole day on problem
Comments
Post a Comment