0

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.

3
  • Usually objects are noncopyable because they have internal state that can not be copied or re-created, so the question here is: what makes your object noncopyable, and does that semantically prevent regeneration from a serialized state? and if not, then why is it noncopyable?
    – PlasmaHH
    Feb 27, 2013 at 13:36
  • 1
    A solution is to serialize boost::shared_ptr<CMyNonCopyableClass> Feb 27, 2013 at 13:49
  • hmm... will try with pointers, dont sure it suits my needs in this case Feb 27, 2013 at 14:44

1 Answer 1

1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.