Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-04-26 07:13:15


On Apr 25, 2004, at 9:29 PM, Peter Dimov wrote:

> In fact, it isn't even clear to me why you need to synchronize access
> to the
> implementation at all, as std::locale is immutable; it has no non-const
> member functions.

Ah, I think I see the confusion. locale is mutable. The copy ctor
mutates the rhs (though not visibly) and the assignment mutates both
sides. There's more refcounting running around under locale's hood
than just the shared_ptr to the implementation. In addition each facet
is individually refcounted (but not with shared_ptr). Even
std::use_facet potentially mutates a locale (via lazy addition of a
standard facet to the locale). This latter technique is one of the
main (portable) ways typically used to drop the code size of HelloWorld
down from astronomical.

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/PDTR18015.pdf

-Howard


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