Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-07-02 10:54:27

>> If you want to store a special 'token' to indicate 'infinity', you'll
>> need to specifically parse for it.

>Perhaps I could alter the behavior of the "ostream& operator<<(ostream&,
>double)" (and istream)?

>Any other idea for a solution would of course be just as welcome....

Problem - serialization of a float/double with an Infinite or Nan value
Fails with a text archive. This is due to the fact that the this archive
class depends upon implementation of stream I/o which apparently doesn't
consider these values for floats.

I would suggest making a small derivation from the standard text archive
which overrides the existing implementation of the load(float &) and
load(double &) with a slightly more elaborate one which can handle these
values. There is an example in the manual on how to do this. I'm no sure
whether or not this facility should be part of the standard text archive or

Fast workaround - use the native binary archive which just saves/loads the
raw bits without trying to interpret them.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at