Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-02-27 16:39:32


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>

> From: "David Abrahams" <david.abrahams_at_[hidden]>
> > There are much worse problems with operator>>() than that one, IMO. How
do
> > you unserialize an object with no default constructor?
>
> Actually I require a default constructor and this hasn't been a problem so
> far. In my initial attempt I used operator<<=/>>= for serialization (<<
and

<snip>

> 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?

-Dave


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