ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
Re: [boost] Re: [serialization] default-constructors (was Re[serialization]problem deserializing vectors)
by Robert Ramey other posts by this author
Oct 3 2003 9:43PM messages near this date
[boost] Problem with ublas/traits.hpp | [boost] Re: Re: [serialization] default-constructors (was Re[serialization]problem deserializing vectors)
Vladimr Prus wrote:

> Robert, could you clarify if default ctor is ineeded required in all cases?

Short answer is no.  The serialization system does not impose any
requirement regarding constructors.

Here is a slightly longer explantation:

case I Serialization objects already created - the most common case

Objects already exist no creation necessary.  serialization saves
and reloads their current state.

case II Serialization of pointers

Objects must be created.  Default non-intrusive load uses a default
constructor ( which may be private).  If an application requires
a non - default constructor a non - default load and save must
be specified.  Usually this will 

a) save construction parameters before saving the object.  
b) load the saved construction parameters before creating the object.
At the time of object creation the construction parameters are 
available so all is well.

All the above is explained in the documentation.

This circumstance which provoked the current confusion is a result
of my interpretation of what it means to serialize a collection - in
this case a vector.

In such a case the most natural (to me) interpretation was to clear the
vector and re-create the vector elements - STL calls default constructor
in this case which you chose to make private to inhibit other potential
callers. 

My response was that I didn't believe that one should even have
a default constructor in such cases.  I showed how to override
the collection load function to implement such a point of view.

Upon reflection, I've come to believe my response was beside the point
and confused the issue.   I am going to tweak the library so that
loading of collections is handled specially and given access to 
any private default constructor.  I now believe that this will not
create any of the problems I originally envisioned.

I believe that this should address all concerns raised.

Robert Ramey


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Robert Ramey
Vladimir Prus
Samuel Krempp
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved