
17 Apr
2004
17 Apr
'04
1:16 a.m.
Ralf W. Grosse-Kunstleve wrote:
Interesting. If I serialize and deserialize std::vector<double> as a text archive but on the same machine, will I always get back exactly the same bit patterns for the double values?
The text archive uses a stream manipulator to set the precision of the output to capture all the precision in the double. It uses the numeric<limits> to determine this. So I can't say it will be exactly the same bit stream but it will be close to the original number. If you want to guarantee the exact representation you can either use the included native binary archive or serialize the data element (double) as a (non-portable) binary object. Robert Ramey