It is a locale constructor.
DeclarationFollowing is the declaration for std::locale::locale.
C++98locale() throw(); locale (const locale& x) throw(); explicit locale (const char* std_name); locale (const locale& x, const char* std_name, category cats); template <class Facet> locale (const locale& x, const locale& y, category cats); locale (const locale& x, Facet* f);C++11
locale() noexcept; locale (const locale& x) noexcept; explicit locale (const char* std_name); explicit locale (const string& std_name); locale (const locale& x, const char* std_name, category cats); locale (const locale& x, const string& std_name, category cats); template <class Facet> locale (const locale& x, const locale& y, category cats); locale (const locale& x, Facet* f);Parameters
x − It copied locale.
std_name − It is a standard C-locale name.
cats − It contains set of categories that are used from the locale specified as second argument.
p &minusl; It is a pointer to a facet object.
y − it is a locale object from which the facets specified in cats are used.
It returns previous global locale object.
ExceptionsStrong guarantee − if an exception is thrown, there are no effects.
ExampleIn below example for std::locale::locale.
#include <iostream> #include <locale> int main (void) { std::locale foo; foo.global(std::locale("")); std::locale bar; std::cout << "bar and foo both are "; std::cout << (foo==bar?"the same":"different"); std::cout << ".\n"; return 0; }
The sample output should be like this −
bar and foo both are different.
locale.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4