Robert Ramey wrote:
Alberto Barbati wrote
BTW, with the current implementation even doing so is completely
useless, as there are lines like this:
os.imbue(std::locale::classic());
that reset the locale of the streams to the "dumb" default. Such lines
are IMO both unnecessary and conceptually wrong, and should be removed.
Now I remember why I included this.
Suppose that an archive is created where the default local is a spanish speaking
country where the number 123 thousand is written
123.000
The archive is sent to another country where the default locale is an english
speaking country where the string
123.000
means 123
That's why I set the local to classic.
I think that at most, you should alter only num_put/num_get facets.
Something like (untested code)
os.imbue(locale(os.loc(), use_facet< num_get<char> >(std::locale::classic()))
(and the same thing for 'numpunct' facet).
Further,
is it a good idea to change stream locale without user's consent. Maybe,
archive should create *their own* (i/o)stream, sharing streambuffer with
the stream the user has passed, and with appropriately modified locale?
- Volodya
Robert Ramey
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost