Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-28 07:14:09


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.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk