Boost logo

Boost :

From: Yitzhak Sapir (ysapir_at_[hidden])
Date: 2002-03-04 07:13:31


I had written something along those lines being discussed now. My
implementation also received a locale parameter (which defaulted to
std::locale()).

Some problems I had with the MSVC 6.0 distributed STL implementation: It
turns out that in "release" mode, this std::locale() constructor would
make an invalid memory access once in a long while. Other calls would
work fine.

It's also probably unwise to create a locale() on entry to such a
function, since this function will be called a lot, and creating a
locale() and extracting the facet from it could be potentially expensive
operations. I tried to make this locale() a global singleton, but ran
into the problems described in the call_once post. However, using a
locale() parameter, and a proper codecvt facet within, one could perform
any needed conversion. (There have been some UTF codecvt facets
submitted to boost).

Perhaps the "right" thing to do would be for the function to receive a
reference to the facet. Then the user can pass whichever facet is
needed or extract one from the appropriate locale?


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