tmp/tmpb4mu5q5n/{from.md → to.md}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
#### `locale` types <a id="locale.types">[[locale.types]]</a>
|
| 2 |
|
| 3 |
##### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
-
|
| 7 |
```
|
| 8 |
|
| 9 |
*Valid* `category` values include the `locale` member bitmask elements
|
| 10 |
`collate`, `ctype`, `monetary`, `numeric`, `time`, and `messages`, each
|
| 11 |
of which represents a single locale category. In addition, `locale`
|
|
@@ -31,11 +31,11 @@ including at least those shown in Table
|
|
| 31 |
[[tab:localization.category.facets]].
|
| 32 |
|
| 33 |
**Table: Locale category facets** <a id="tab:localization.category.facets">[tab:localization.category.facets]</a>
|
| 34 |
|
| 35 |
| Category | Includes facets |
|
| 36 |
-
| -------- | --------------------------------------------------- |
|
| 37 |
| collate | `collate<char>`, `collate<wchar_t>` |
|
| 38 |
| ctype | `ctype<char>`, `ctype<wchar_t>` |
|
| 39 |
| | `codecvt<char, char, mbstate_t>` |
|
| 40 |
| | `codecvt<char16_t, char, mbstate_t>` |
|
| 41 |
| | `codecvt<char32_t, char, mbstate_t>` |
|
|
@@ -52,22 +52,22 @@ including at least those shown in Table
|
|
| 52 |
| messages | `messages<char>`, `messages<wchar_t>` |
|
| 53 |
|
| 54 |
|
| 55 |
For any locale `loc` either constructed, or returned by
|
| 56 |
`locale::classic()`, and any facet `Facet` shown in Table
|
| 57 |
-
[[tab:localization.category.facets]], `has_facet<Facet>(loc)` is true.
|
| 58 |
Each `locale` member function which takes a `locale::category` argument
|
| 59 |
operates on the corresponding set of facets.
|
| 60 |
|
| 61 |
An implementation is required to provide those specializations for facet
|
| 62 |
templates identified as members of a category, and for those shown in
|
| 63 |
Table [[tab:localization.required.specializations]].
|
| 64 |
|
| 65 |
**Table: Required specializations** <a id="tab:localization.required.specializations">[tab:localization.required.specializations]</a>
|
| 66 |
|
| 67 |
| Category | Includes facets |
|
| 68 |
-
| -------- | ------------------------------------------------------- |
|
| 69 |
| collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
|
| 70 |
| ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
|
| 71 |
| | `codecvt_byname<char, char, mbstate_t>` |
|
| 72 |
| | `codecvt_byname<char16_t, char, mbstate_t>` |
|
| 73 |
| | `codecvt_byname<char32_t, char, mbstate_t>` |
|
|
@@ -99,14 +99,14 @@ In declarations of facets, a template parameter with name
|
|
| 99 |
`InputIterator` or `OutputIterator` indicates the set of all possible
|
| 100 |
specializations on parameters that satisfy the requirements of an Input
|
| 101 |
Iterator or an Output Iterator, respectively (
|
| 102 |
[[iterator.requirements]]). A template parameter with name `C`
|
| 103 |
represents the set of types containing `char`, `wchar_t`, and any other
|
| 104 |
-
implementation-defined character types that satisfy the requirements
|
| 105 |
-
a character on which any of the iostream components can be
|
| 106 |
-
A template parameter with name `International` represents
|
| 107 |
-
possible specializations on a bool parameter.
|
| 108 |
|
| 109 |
##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
namespace std {
|
|
@@ -118,25 +118,32 @@ namespace std {
|
|
| 118 |
void operator=(const facet&) = delete;
|
| 119 |
};
|
| 120 |
}
|
| 121 |
```
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
Template parameters in this Clause which are required to be facets are
|
| 124 |
those named `Facet` in declarations. A program that passes a type that
|
| 125 |
is *not* a facet, or a type that refers to a volatile-qualified facet,
|
| 126 |
as an (explicit or deduced) template parameter to a locale function
|
| 127 |
expecting a facet, is ill-formed. A const-qualified facet is a valid
|
| 128 |
template argument to any locale function that expects a Facet template
|
| 129 |
parameter.
|
| 130 |
|
| 131 |
The `refs` argument to the constructor is used for lifetime management.
|
| 132 |
-
|
| 133 |
-
- For `refs == 0`, the implementation performs
|
| 134 |
`delete static_cast<locale::facet*>(f)` (where `f` is a pointer to the
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
facet.
|
| 138 |
|
| 139 |
Constructors of all facets defined in this Clause take such an argument
|
| 140 |
and pass it along to their `facet` base class constructor. All
|
| 141 |
one-argument constructors defined in this Clause are *explicit*,
|
| 142 |
preventing their participation in automatic conversions.
|
|
@@ -164,17 +171,17 @@ namespace std {
|
|
| 164 |
id(const id&) = delete;
|
| 165 |
};
|
| 166 |
}
|
| 167 |
```
|
| 168 |
|
| 169 |
-
The class locale::id provides identification of a locale facet
|
| 170 |
interface, used as an index for lookup and to encapsulate
|
| 171 |
initialization.
|
| 172 |
|
| 173 |
-
Because facets are used by iostreams, potentially while
|
| 174 |
-
constructors are running, their initialization cannot depend on
|
| 175 |
programmed static initialization. One initialization strategy is for
|
| 176 |
`locale` to initialize each facet’s `id` member the first time an
|
| 177 |
instance of the facet is installed into a locale. This depends only on
|
| 178 |
static storage being zero before constructors run (
|
| 179 |
-
[[basic.start.
|
| 180 |
|
|
|
|
| 1 |
#### `locale` types <a id="locale.types">[[locale.types]]</a>
|
| 2 |
|
| 3 |
##### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
+
using category = int;
|
| 7 |
```
|
| 8 |
|
| 9 |
*Valid* `category` values include the `locale` member bitmask elements
|
| 10 |
`collate`, `ctype`, `monetary`, `numeric`, `time`, and `messages`, each
|
| 11 |
of which represents a single locale category. In addition, `locale`
|
|
|
|
| 31 |
[[tab:localization.category.facets]].
|
| 32 |
|
| 33 |
**Table: Locale category facets** <a id="tab:localization.category.facets">[tab:localization.category.facets]</a>
|
| 34 |
|
| 35 |
| Category | Includes facets |
|
| 36 |
+
| -------- | ----------------------------------------------------- |
|
| 37 |
| collate | `collate<char>`, `collate<wchar_t>` |
|
| 38 |
| ctype | `ctype<char>`, `ctype<wchar_t>` |
|
| 39 |
| | `codecvt<char, char, mbstate_t>` |
|
| 40 |
| | `codecvt<char16_t, char, mbstate_t>` |
|
| 41 |
| | `codecvt<char32_t, char, mbstate_t>` |
|
|
|
|
| 52 |
| messages | `messages<char>`, `messages<wchar_t>` |
|
| 53 |
|
| 54 |
|
| 55 |
For any locale `loc` either constructed, or returned by
|
| 56 |
`locale::classic()`, and any facet `Facet` shown in Table
|
| 57 |
+
[[tab:localization.category.facets]], `has_facet<Facet>(loc)` is `true`.
|
| 58 |
Each `locale` member function which takes a `locale::category` argument
|
| 59 |
operates on the corresponding set of facets.
|
| 60 |
|
| 61 |
An implementation is required to provide those specializations for facet
|
| 62 |
templates identified as members of a category, and for those shown in
|
| 63 |
Table [[tab:localization.required.specializations]].
|
| 64 |
|
| 65 |
**Table: Required specializations** <a id="tab:localization.required.specializations">[tab:localization.required.specializations]</a>
|
| 66 |
|
| 67 |
| Category | Includes facets |
|
| 68 |
+
| -------- | --------------------------------------------------------- |
|
| 69 |
| collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
|
| 70 |
| ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
|
| 71 |
| | `codecvt_byname<char, char, mbstate_t>` |
|
| 72 |
| | `codecvt_byname<char16_t, char, mbstate_t>` |
|
| 73 |
| | `codecvt_byname<char32_t, char, mbstate_t>` |
|
|
|
|
| 99 |
`InputIterator` or `OutputIterator` indicates the set of all possible
|
| 100 |
specializations on parameters that satisfy the requirements of an Input
|
| 101 |
Iterator or an Output Iterator, respectively (
|
| 102 |
[[iterator.requirements]]). A template parameter with name `C`
|
| 103 |
represents the set of types containing `char`, `wchar_t`, and any other
|
| 104 |
+
*implementation-defined* character types that satisfy the requirements
|
| 105 |
+
for a character on which any of the iostream components can be
|
| 106 |
+
instantiated. A template parameter with name `International` represents
|
| 107 |
+
the set of all possible specializations on a bool parameter.
|
| 108 |
|
| 109 |
##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
namespace std {
|
|
|
|
| 118 |
void operator=(const facet&) = delete;
|
| 119 |
};
|
| 120 |
}
|
| 121 |
```
|
| 122 |
|
| 123 |
+
Class `facet` is the base class for locale feature sets. A class is a
|
| 124 |
+
*facet* if it is publicly derived from another facet, or if it is a
|
| 125 |
+
class derived from `locale::facet` and contains a publicly accessible
|
| 126 |
+
declaration as follows: [^3]
|
| 127 |
+
|
| 128 |
+
``` cpp
|
| 129 |
+
static ::std::locale::id id;
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
Template parameters in this Clause which are required to be facets are
|
| 133 |
those named `Facet` in declarations. A program that passes a type that
|
| 134 |
is *not* a facet, or a type that refers to a volatile-qualified facet,
|
| 135 |
as an (explicit or deduced) template parameter to a locale function
|
| 136 |
expecting a facet, is ill-formed. A const-qualified facet is a valid
|
| 137 |
template argument to any locale function that expects a Facet template
|
| 138 |
parameter.
|
| 139 |
|
| 140 |
The `refs` argument to the constructor is used for lifetime management.
|
| 141 |
+
For `refs == 0`, the implementation performs
|
|
|
|
| 142 |
`delete static_cast<locale::facet*>(f)` (where `f` is a pointer to the
|
| 143 |
+
facet) when the last `locale` object containing the facet is destroyed;
|
| 144 |
+
for `refs == 1`, the implementation never destroys the facet.
|
|
|
|
| 145 |
|
| 146 |
Constructors of all facets defined in this Clause take such an argument
|
| 147 |
and pass it along to their `facet` base class constructor. All
|
| 148 |
one-argument constructors defined in this Clause are *explicit*,
|
| 149 |
preventing their participation in automatic conversions.
|
|
|
|
| 171 |
id(const id&) = delete;
|
| 172 |
};
|
| 173 |
}
|
| 174 |
```
|
| 175 |
|
| 176 |
+
The class `locale::id` provides identification of a locale facet
|
| 177 |
interface, used as an index for lookup and to encapsulate
|
| 178 |
initialization.
|
| 179 |
|
| 180 |
+
[*Note 1*: Because facets are used by iostreams, potentially while
|
| 181 |
+
static constructors are running, their initialization cannot depend on
|
| 182 |
programmed static initialization. One initialization strategy is for
|
| 183 |
`locale` to initialize each facet’s `id` member the first time an
|
| 184 |
instance of the facet is installed into a locale. This depends only on
|
| 185 |
static storage being zero before constructors run (
|
| 186 |
+
[[basic.start.static]]). — *end note*]
|
| 187 |
|