
- The C Standard Library
- The C Standard Library
- The C++ Standard Library
- C++ Library - Home
- C++ Library - <fstream>
- C++ Library - <iomanip>
- C++ Library - <ios>
- C++ Library - <iosfwd>
- C++ Library - <iostream>
- C++ Library - <istream>
- C++ Library - <ostream>
- C++ Library - <sstream>
- C++ Library - <streambuf>
- C++ Library - <atomic>
- C++ Library - <complex>
- C++ Library - <exception>
- C++ Library - <functional>
- C++ Library - <limits>
- C++ Library - <locale>
- C++ Library - <memory>
- C++ Library - <new>
- C++ Library - <numeric>
- C++ Library - <regex>
- C++ Library - <stdexcept>
- C++ Library - <string>
- C++ Library - <thread>
- C++ Library - <tuple>
- C++ Library - <typeinfo>
- C++ Library - <utility>
- C++ Library - <valarray>
- The C++ STL Library
- C++ Library - <array>
- C++ Library - <bitset>
- C++ Library - <deque>
- C++ Library - <forward_list>
- C++ Library - <list>
- C++ Library - <map>
- C++ Library - <queue>
- C++ Library - <set>
- C++ Library - <stack>
- C++ Library - <unordered_map>
- C++ Library - <unordered_set>
- C++ Library - <vector>
- C++ Library - <algorithm>
- C++ Library - <iterator>
- C++ Programming Resources
- C++ Programming Tutorial
- C++ Useful Resources
- C++ Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
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.
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
Advertisements