 st8b7c:f320:99b9:690f:4595:cd17:293a:c069local8b7c:f320:99b9:690f:4595:cd17:293a:c069locale    Defined in header <locale>         (1)     locale() throw();
  (until C++11)     locale() noexcept;
  (since C++11)     (2)     locale( const locale& other ) throw();
  (until C++11)     locale( const locale& other ) noexcept;
  (since C++11)     explicit locale( const char* std_name );
  (3)       explicit locale( const st8b7c:f320:99b9:690f:4595:cd17:293a:c069string& std_name );
  (4)   (since C++11)     locale( const locale& other, const char* std_name, category cat );
  (5)       locale( const locale& other, const st8b7c:f320:99b9:690f:4595:cd17:293a:c069string& std_name, category cat );
  (6)   (since C++11)     template< class Facet >
locale( const locale& other, Facet* f );
  (7)       locale( const locale& other, const locale& one, category cat );
  (8)      Contstructs a new locale object.

1) Default constructor. Constructs a copy of the global C++ locale, which is the locale most recently used as the argument to st8b7c:f320:99b9:690f:4595:cd17:293a:c069local8b7c:f320:99b9:690f:4595:cd17:293a:c069global or a copy of st8b7c:f320:99b9:690f:4595:cd17:293a:c069local8b7c:f320:99b9:690f:4595:cd17:293a:c069classic if no call to st8b7c:f320:99b9:690f:4595:cd17:293a:c069local8b7c:f320:99b9:690f:4595:cd17:293a:c069global has been made. 
2) Copy constructor. Constructs a copy of other. 
3-4) Constructs a copy of the system locale with specified std_name (such as "C", or "POSIX", or "en_US.UTF-8", or "English_US.1251"), if such locale is supported by the operating system. The locale constructed in this manner has a name. 
5-6) Constructs a copy of other except for all the facets identified by the cat argument, which are copied from the system locale identified by its std_name. The locale constructed in this manner has a name if and only if other has a name. 
7) Constructs a copy of other except for the facet of type Facet (typically deduced from the type of the argument) which is installed from the argument facet. If facet is a null pointer, the constructed locale is a full copy of other. The locale constructed in this manner has no name. 
8) Constructs a copy of other except for all the facets identified by the cat argument, which are copied from one. If both other and one have names, then the resulting locale also has a name.  Parameters    other   -   another locale to copy 
   std_name   -   name of the system locale to use 
   f   -   pointer to a facet to merge with other 
   cat   -   the locale category used to identify the facets to merge with other 
   one   -   another locale to take facets from 

  Exceptions 
3,5) st8b7c:f320:99b9:690f:4595:cd17:293a:c069runtime_error if the operating system has no locale named std_name or if std_name is a null pointer. 
4,6) st8b7c:f320:99b9:690f:4595:cd17:293a:c069runtime_error if the operating system has no locale named std_name. 
7,8) May throw implementation-defined exceptions.  Notes Overload 7 is typically called with its second argument, f, obtained directly from a new-expression: the locale is responsible for calling the matching delete from its own destructor.
 Example  #include <codecvt>
#include <iostream>
#include <locale>
 
st8b7c:f320:99b9:690f:4595:cd17:293a:c069ostream& operator<< (st8b7c:f320:99b9:690f:4595:cd17:293a:c069ostream& os, st8b7c:f320:99b9:690f:4595:cd17:293a:c069locale const& loc)
{
    if (loc.name().length() <= 80) { return os << loc.name() << '\n'; }
 
    for (const auto c : loc.name())
    {
        c != ';' ? os << c : os << "\n    ";
    }
    return os << '\n';
}
 
int main()
{
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069locale l1; 
        // l1 is a copy of the classic "C" locale
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069locale l2("en_US.UTF-8");
        // l2 is a unicode locale
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069locale l3(l1, l2, st8b7c:f320:99b9:690f:4595:cd17:293a:c069local8b7c:f320:99b9:690f:4595:cd17:293a:c069ctype);
        // l3 is "C" except for ctype, which is unicode
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069locale l4(l1, new st8b7c:f320:99b9:690f:4595:cd17:293a:c069codecvt_utf8<wchar_t>);
        // l4 is "C" except for codecvt
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069cout
        << "Locale names:\n"
        << "l1: " << l1 << "l2: " << l2
        << "l3: " << l3 << "l4: " << l4;
} Possible output:
Locale names:
l1: C
l2: en_US.UTF-8
l3: LC_CTYPE=en_US.UTF-8
    LC_NUMERIC=C
    LC_TIME=C
    LC_COLLATE=C
    LC_MONETARY=C
    LC_MESSAGES=C
    LC_PAPER=C
    LC_NAME=C
    LC_ADDRESS=C
    LC_TELEPHONE=C
    LC_MEASUREMENT=C
    LC_IDENTIFICATION=C
l4: *   See also     (destructor)   destructs the locale and the facets whose reference count becomes zero  (public member function) 
  

    
{'path': 'public/docs/cpp/locale/locale/locale.html', 'source': 'DevDocs.IO'}