Boost logo

Boost :

From: Loïc Joly (loic.actarus.joly_at_[hidden])
Date: 2005-08-23 15:49:14

Hello everybody,

I've read the rationale for only allowing const trackable objects, but
here is my problem :

I want to serialize the following class :

class C : boost::noncopyable
   void setData(string s) {data = s;}

int main()
   C c;
   c.setData("Hello world");
   vector <C*> v;
   ar << c << c;

To have a c with meaningfull data, it cannot be const.
I cannot create a local object that is a copy of the object (it is
I do not think making the object untracked would be a good idea in this
case (I might be wrong ?)
So far, the best way I found to be able to serialize this object is :

C const & cForSerialize = c;
ar << cForSerialize << cForSerialize;

But I do not think this is really elegant code. Is there a better
alternative ?


Boost list run by bdawes at, gregod at, cpdaniel at, john at