Files
2025-10-25 03:02:53 +03:00

5.4 KiB
Raw Permalink Blame History

[locale.cons]

28 Text processing library [text]

28.3 Localization library [localization]

28.3.3 Locales [locales]

28.3.3.1 Class locale [locale]

28.3.3.1.3 Constructors and destructor [locale.cons]

🔗

locale() noexcept;

1

#

Effects: Constructs a copy of the argument last passed tolocale::global(locale&), if it has been called; else, the resulting facets have virtual function semantics identical to those of locale::classic().

[Note 1:

This constructor yields a copy of the current global locale.

It is commonly used as a default argument for function parameters of type const locale&.

— end note]

🔗

explicit locale(const char* std_name);

2

#

Effects: Constructs a locale using standard C locale names, e.g., "POSIX".

The resulting locale implements semantics defined to be associated with that name.

3

#

Throws: runtime_error if the argument is not valid, or is null.

4

#

Remarks: The set of valid string argument values is"C", "", and any implementation-defined values.

🔗

explicit locale(const string& std_name);

5

#

Effects: Equivalent to locale(std_name.c_str()).

🔗

locale(const locale& other, const char* std_name, category cats);

6

#

Preconditions: cats is a valid category value ([locale.category]).

7

#

Effects: Constructs a locale as a copy of other except for the facets identified by the category argument, which instead implement the same semantics as locale(std_name).

8

#

Throws: runtime_error if the second argument is not valid, or is null.

9

#

Remarks: The locale has a name if and only if other has a name.

🔗

locale(const locale& other, const string& std_name, category cats);

10

#

Effects: Equivalent to locale(other, std_name.c_str(), cats).

🔗

template<class Facet> locale(const locale& other, Facet* f);

11

#

Effects: Constructs a locale incorporating all facets from the first argument except that of type Facet, and installs the second argument as the remaining facet.

If f is null, the resulting object is a copy of other.

12

#

Remarks: If f is null, the resulting locale has the same name as other.

Otherwise, the resulting locale has no name.

🔗

locale(const locale& other, const locale& one, category cats);

13

#

Preconditions: cats is a valid category value.

14

#

Effects: Constructs a locale incorporating all facets from the first argument except those that implement cats, which are instead incorporated from the second argument.

15

#

Remarks: If cats is equal to locale::none, the resulting locale has a name if and only if the first argument has a name.

Otherwise, the resulting locale has a name if and only if the first two arguments both have names.

🔗

const locale& operator=(const locale& other) noexcept;

16

#

Effects: Creates a copy of other, replacing the current value.

17

#

Returns: *this.