Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-04-20 10:01:39


On Thu, 20 Apr 2006 11:04:45 +0100, Paul A Bristow wrote

> | > So some special flag would be needed to hold the Nan or Inf nature.
> | >
> | > If only there was a Standard representation of Nan and Infs.
> VERY | > shortsighted, making NaNs and infs hardly useable. | |
> Agreed. The types in date_time have the ability to serialize | and deserilize
> | NADT (not a date time), -infinity and +infinity. Why
> | couldn't there be a
> | simple extension to the numpunct<charT> facet to define an
> | appropriate output
> | string? Basically something like:
> |
> | //see Langer and Kreft p 414...
> | template<class charT>
> | class numpunct : public locale::facet {
> |
> | //new functions for nan and infinity
> | string_type not_a_number_name() const;
> | string_type infinity_name() const;
> |
> | And you'd have to fix num_get as well.
>
> Looks a good idea - but these facets look complicated to my inexpert
> eye.
>
> Should we ALSO press to get a 'proper' C++0x Standard solution to this?

Maybe it isn't clear, these facets already exist (hence the ref to L&K p414).
I'm just suggesting that we write a proposal to add a couple methods and them
modify the 'get'/'put' functions to use them. In fact, someone could probably
write an extended facet to do just this and submit it to Boost if so
motivated. That, frankly, would be more valuable than the change to the standard.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk