|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-01-12 12:14:03
Ares Lagae <ares.lagae_at_[hidden]> writes:
>> If you're willing to intrude on the design of Foo, there are much
>> cleaner solutions using friend. However, non-intrusive serialization
>> should generally be possible even for classes which are
>> well-encapsulated.
>
> ok (i'm just making suggestions for the sake of discussion here)
>
> suppose we do it like this:
>
<snip>
> with this mechanism the user has the choise between intrusive and
> non-intrusive serialisation
> - intrusive: in class A, initialize a Class<A> object with the datamembers
> - non intrusive: for class B, specialize the Class<B> template
The challenging part about the non-intrusive case is
*de-serialization*, though.
AFAICT, the Python approach of serializing something which can be used
to get constructor arguments for de-serializing (probably with
placement new) is a promising strategy.
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk