Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with Boost Serialization
From: Matthias Troyer (troyer_at_[hidden])
Date: 2010-03-04 03:22:01


On 4 Mar 2010, at 00:54, Binh Luong wrote:

>
> Hi,
>
> thank you very much for your answer. I was stuck with this problem for days.
> I have changed the code so that a const pointer is now passed to the
> RemoteMessagingSystem::serialize:
> string RemoteMessagingSystem::serialize (Message* const msg)
> {
> ...
> }
>
> But the problem with deserialize is still there:
>

> Here is the code fragement:
> Message* RemoteMessagingSystem::deserialize (string data)
> {
> stringstream archivStream (data, ios_base::binary | ios_base::in);
> #ifdef REMOTE_XML
> boost::archive::xml_iarchive inputArchive( archivStream );
> #else
> boost::archive::binary_iarchive inputArchive( archivStream );
> #endif
>
> Message* msg = NULL; //line 164
> inputArchive >> msg;
>
> return msg;
> }
>
> Should I also change here Message* to Message* const?
>
> Actually it is something strange because with the old versoin Boost 1.38
> there are no compiling errors. Since i compiled and installed the new
> version 1.42 i got those errors. Something should be changed between the 2
> versions although i have compared the both source codes but do not find any
> difference :/

Did you try putting it into an NVP wrapper? AFAIK XML archives only serialize NVPs

Matthias


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