|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-02-28 07:54:38
----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, February 28, 2002 7:14 AM
Subject: Re: [boost] Re: Serialization (Persistence) library draft
submission
> From: "David Abrahams" <david.abrahams_at_[hidden]>
> > > The Attributes object is typically the name of the Value, i.e. (real
> code)
> > >
> > > template<class W, class T, class A> void write(W & w, math::point2<T>
> > const
> > > & p, A const & a, int)
> > > {
> > > begin_struct(w, a & type_descriptor(p));
> > > write(w, p[0], "x", 0);
> > > write(w, p[1], "y", 0);
> > > end_struct(w, a & type_descriptor(p));
> > > }
> >
> > If you're willing to require a default constructor, shouldn't you also
> find
> > a way to describe the type once so you don't have to code a reader and a
> > writer that look nearly identical?
>
> Having to code three nearly identical serialization helpers is certainly a
> bit annoying, but not _that_ annoying so I haven't been forced to come up
> with solution yet.
>
> Jens' describe() scheme is fine, but it doesn't extend to attributes well,
> and doesn't handle versioning (it makes things assymetrical.)
I haven't looked at Jens' scheme.
I was thinking that it might be better for many applications to be
intrusive, so instead of including a T member, you use a serializable<T>.
Then there are all sorts of opportunities for adding policies for
versioning, etc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk