Boost logo

Boost :

Subject: Re: [boost] [locale] Strange(?) result in example code
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2011-04-16 05:40:10


> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
> On Behalf Of Noah Roberts
> Sent: Friday, April 15, 2011 8:43 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] [locale] Strange(?) result in example code
>
> On 4/15/2011 12:38 PM, Artyom wrote:
>
> > std::cout.imbue(std::locale()); // Now global locale imbued to stream as
well.
>
> LOL, DUH! OK. Thanks.

Well join the club - I've fallen into this pit recently :-(

Am I correct in thinking that the reason is that std::cout is constructed
*before* the new locale is 'globalled'?

And so std::cerr needs imbuing too but that fstream and stringstreams
constructed after the std::locale::global("en_US.UTF-8") statement will get
the new locale?

Paul

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]

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