Re: [Boost-users] Serialization -- Which constructor is called?
Sorry, I should have described my usage a bit better. I am de-serializing from a pointer to a class which then contains vectors of other shared_ptr's to yet more classes. None of the default constructors seem to be hitting my breakpoints -- which could be a GDB issue for all I know. I'll add the load_construct_data function to my class to see if that helps. On a side issue, I sometimes get stream_exception's thrown when de-serializing. Since the stream is still good, I'm assuming that this is caused by an un-registered class being de-serialized. Do you have any pointers as to how I can debug this? Thanks, Eric
Robert Ramey wrote:
A couple of hints:
a) constructor is called only when de-serializing a pointer. So unless you're doing this you won't see and constructor call.
b) When creating a new object in the course of de-serializing a pointer,
the
function load_construct_data is callled. This calls an in place new for the default constructor. By specializing this function for your particular class, you can arrange to call a non-default constructor.
Robert Ramey
Eric wrote:
In debugging a problem, I put breakpoints on the default and copy constructor along with the operator=. When de-serializing the class, none of the breakpoints were hit.
I've searched through the documentation and old posts and can't seem to find any reference to which constructor is called from the serialization class. Could someone enlighten me on this? I'm sure it's covered somewhere, but I've somehow missed it.
Thanks,
Eric
Boost 1.32 under Linux
________________________________________________ Message sent using UebiMiau 2.7.2
participants (1)
-
Eric-public