
Robert Ramey wrote:
Johan Råde wrote:
What do you thing of Robert Ramey's idea of making it possible to configure a stream to report an error when a non-finite number is inserted or extracted? This could be done with a new stream flag and corresponding manipulators.
Actually I was envisioning that one would just add the desired facet after the stream was created. I don't see that this would require any new stream flags or manipulators. Something like
// make a new locale std::locale float_locale(std::locale::global(), new codecvt_strict_float()); fostream os("filename"); os.imbue(float_locale);
//... operations on os use fixed or strict floating point output
Robert Ramey
Yes, in the short run, yes. That is what I've put togegther. But Paul is working on a proposal to the C++ standardization committee to get proper handling of infinity and NaN into the standard streams, without the need for special facets. P.S. These are not codecvt facets. They are num_put and num_get facets. Different base classes. Johan Råde