Re:[boost] Serialization of infinite double - from comp.lang.c++

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 not. Fast workaround - use the native binary archive which just saves/loads the raw bits without trying to interpret them. Robert Ramey
participants (1)
-
Robert Ramey