A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/cpp_standard_library/cpp_locale_constructor.htm below:

C++ Locale Library - constructor

C++ Locale Library - constructor Description

It is a locale constructor.

Declaration

Following is the declaration for std::locale::locale.

C++98
	
   locale() 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 Return Value

It returns previous global locale object.

Exceptions

Strong guarantee − if an exception is thrown, there are no effects.

Example

In 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