std::locale::global(3)
π·οΈ NAME
std::locale::global β yep, literally std::locale::global again, itβs giving main-character name card π
Hii bestie π welcome to the std::locale::global(3) page from the C++ Standard Libary manual! Buckle up, this oneβs short but lowkey important.
β¨ Synopsis
It lives in the header <locale>, bestie:
Defined in header <locale>
static locale global( const locale& loc );
Okay so what it does: it replaces the global C++ locale with loc, which means all future calls to the std::locale default constructor will now return a copy of loc. If loc has a name, it also replaces the C locale as if by std::setlocale(LC_ALL, loc.name().c_str());.
This function is the only way to modify the global C++ locale, which is otherwise equivalent to std::locale::classic() at program startup. No cap, thatβs the whole vibe π
π§Έ Parameters
locβ the new global C++ locale π«Ά
π Return value
The previous value of the global C++ locale. Itβs giving βhereβs what you had before, bestieβ β¨
π Example
This section is incomplete.
Reason: no example π
Not me wanting an example so bad but the page literally says there isnβt one. We respect the honesty tho π«‘
π©Ή Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR:
LWG 8 - Applied to:
C++98 - Behavior as published: it was unspecified whether other library functions (such as
std::setlocale) can modify the global C++ locale - Correct behavior: specified (no other library functions allowed)
π See also
constructorβ constructs a new locale (public member function)classicβ obtains a reference to the"C"locale[static](public static member function)setlocaleβ gets and sets the current C locale (function)
ποΈ Category
* Todo no example
mwah π β source http://cppreference.com, version/date 2024.06.10, page std::locale::global(3).
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms