Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-11-24 20:08:24


Larry Smith wrote:
>
> ar & fld; // where fld is: char[200]
>
> What's the secret trick?

There a couple of ways. On is to derive your archive from text_?archive
and add special handling for arrays. Look at demo_fast_archive which
does this for arrays - (It uses binary_?archive as a base - but that's not
important here).

> The structs also contain many 'double' fields.
> If the precision is the (default?) 6 when serialized,
> that won't be enough. Is there a way to control
> the precision of doubles when they are written to
> a text archive?

Hmmm - the precision saved in a text archive is determined by the
numeric traits on the machine creating the archive so I would hope
that the default precision would be the exact correct one. Also it
might depend on the stream implementation. I don't think fact that a
particular
value is rendered to 6 places means anything. That is I would expect that
the value 2.0 is rendered as "2.0" rather than "2.000000000000000" .

I don't remember off hand where the precision is set. I would expect its
easy to change in the stream after the archive is opened.

Robert Ramey

>
> Thanks,
> Larry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net