cpp/locale/locale

An object of class is an immutable indexed set of immutable facets. Each stream object of the C++ input/output library is associated with an object and uses its facets for parsing and formatting of all data. Locale objects can also be used as predicates that perform string collation with the standard containers and algorithms and can be accessed directly to obtain or modify the facets they hold.

Each locale constructed in a C++ program holds at least the following standard facets (i.e. std returns for all these facet types), but a program may define additional specializations or completely new facets and add them to any existing locale object.

Internally, a locale object is implemented as if it is a reference-counted pointer to an array (indexed by std) of reference-counted pointers to facets: copying a locale only copies one pointer and increments several reference counts. To maintain the standard C++ library thread safety guarantees (operations on different objects are always thread-safe), both the locale reference count and each facet reference count are updated in a thread-safe manner, similar to std.

Member objects
member functions expecting a argument require one of the category values defined above, or the union of two or more such values. The are not accepted.