Boost logo

Boost :

Subject: Re: [boost] [locale] Strange(?) result in example code
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-04-18 10:15:58


Paul A. Bristow wrote:
> On Behalf Of Artyom
>
> > Yes, basically if you want to do it fully for standard
> > library and boost:
> >
> > std::locale::global(loc);
> > std::cout.imbue(loc);
> > std::cin.imbue(loc);
> > std::cerr.imbue(loc);
> > std::clog.imbue(loc);
> >
> > std::wcout.imbue(loc);
> > std::wcin.imbue(loc);
> > std::wcerr.imbue(loc);
> > std::wclog.imbue(loc);
> >
> > // this is for boost filesystem
> > boost::filesystem::path::imbue(loc);
>
> Thanks for this confirmation.
>
> This seems such an obviously attractive pit, I am sure Noah
> and I won't be the last to fall in it ;-)
>
> I think Boost.Locale docs would be a good place to remind
> users of locale of its existence, including a reference to
> 27.4.2.3/4 of C++03.
>
> Would you like to add it as a [warning ....]?

What about library provided functions, such as the following?

void
imbue_globally(_locale)
{
   std::locale::global(_locale);
   std::cout.imbue(_locale);
   std::cin.imbue(_locale);
   std::cerr.imbue(_locale);
   std::clog.imbue(_locale);
}

void
wimbue_globally(_locale)
{
   std::locale::global(_locale);
   std::wcout.imbue(_locale);
   std::wcin.imbue(_locale);
   std::wcerr.imbue(_locale);
   std::wclog.imbue(_locale);
}

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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