|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-10-05 13:49:54
Samuel Krempp <krempp_at_[hidden]> writes:
> le Sunday 05 October 2003 13:57, dave_at_[hidden] écrivit :
>> You can deserialize non-collections without constructing them
>> somehow?? That surprises me. Or do you mean something else?
>
> I've had the same reaction. In fact it's not all non-collections, but some
> kinds of objects that can be deserialized without the lib needing to
> construct anything :
>
> When an object is deserialized explictly by the user, she provides a
> constructed object to the serialization lib.
I guess I have to ask, "why?"
That seems potentially wasteful, and it may not even be possible to
construct an appropriate object other than by deserializing.
> If this object is a container of some sort (or is a pointer, or holds
> pointers, etc..), sub-objects might have to be constructed by the
> deserialization code.
> If it's not the case, all constructions have already been done, and the lib
> just calls deserialization functions on constructed objects (conceptually,
> they are the exception, and collections fall into the more general
> category)
It seems like everything would be simpler if the library just provided
the general case, and allowed the user to use post-deserialization
assignment in the case where she wants to overwrite an existing
object. But I may be missing something.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk