Boost serialization - Serialize noncopyable but movable objects?

204 Views Asked by At

Is it possible somehow? It doesnt work out of the box since it tries to copy objects when the object gets unserialized

Update 1: These objects are noncopyable just because they allocate memory, once it is allocated I dont see any reason to copy when it can be moved. The unserialization part should be kept as fast as possible.

1

There are 1 best solutions below

0
On

I had a similar problem once some time ago, and IIRC I did not find any solution to this, so instead I unserialized an object of another type and fed that into the actual object's construtor. That other type was designed just to make deserialization fast and move its contents to the acutal object.