Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-02-27 16:52:12


----- Original Message -----
From: "rameysb" <ramey_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, February 27, 2002 6:41 PM
Subject: [boost] Re: Serialization (Persistence) library draft submission

> --- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> >
> > ----- Original Message -----
> > From: "Yitzhak Sapir" <ysapir_at_y...>
> >
> >
> > > > 3) ar << * static_cast<const bus_stop *>(this);
> > > >
> > >
> > > Implementing serialization with << and >> is nice, and it allows
> you to
> > > write code like this:
> > >
> > > socketstream << some_object;
> > > cout << some_object;
> > >
> > > which looks very generic. In fact, you may not even need to know
> which
> > > type of stream you're serializing too. However, This is also
> > > problematic. << and >> were not meant for serialization of
> restorable
> > > non-fielded data as far as I can see. That is, cout << 23 <<
> 34; would
> > > print 2334. Sent to a file and read back to an int, you'd
> read "2334".
> >
> > There are much worse problems with operator>>() than that one, IMO.
> How do
> > you unserialize an object with no default constructor?
> >
> > -Dave
>
> 1) the class iarchive and oarchive are not derivations of streams.
> They are implemented in terms of strings. the << operator for all
> primitives are implemented to add a space after a number. Other
> stream operations are not implemented by archives. so iarchive << 23
> << 34 results in "23 34" being appended to the archive. There is are
> special << and >> for strings.
>
Does this mean that everything is serialized as text?

If I have a long double value, will it be serialized as a text string?
In this case, is it guaranteed that the de-serialized value will be
identical to the serialized one? (this requires a careful fp<->decimal
conversion)

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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