Boost logo

Boost :

Subject: Re: [boost] [Filesystem.v3] Request to rename imbue to something else like global_locale
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-03-11 10:02:43


Artyom wrote:
>
> The static member function
>
> boost::filesystem::path::imbue(std::locale const &)
>
> Is very misleading.
>
> boost::filesystem::path p;
> p.imbue(some_locale);
> p="some_file.txt";
>
> Which looks like you change p's locale and not global locale.

I certainly thought so from the various examples like that I've seen on this list. (I never read the documentation nor noted that imbue() was static, but the code above in no way appears to affect all instances.)

> I'd recommend, provide static member function
>
> boost::filesystem::path::global_locale

"default_locale" would be better since it only affects filesystem::path objects, not everything in the system. That name may not be good enough, though:

   p.default_locale(some_locale);

That still seems to affect only the instance, though somewhat less than does "imbue."

> With same semantics as imbue and deprecate imbue.

Why not keep imbue() but make it affect individual instances, then add a new function that affects all instances not otherwise affected by a call to imbue()? That suggests a locale pointer in each instance that, if null, means to use the default locale.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
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