From Jason Turner

[locales]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwd7nmtui/{from.md → to.md} +58 -79
tmp/tmpwd7nmtui/{from.md → to.md} RENAMED
@@ -4,22 +4,22 @@
4
 
5
  ``` cpp
6
  namespace std {
7
  class locale {
8
  public:
9
- // types:
10
  class facet;
11
  class id;
12
  using category = int;
13
  static const category // values assigned here are for exposition only
14
  none = 0,
15
  collate = 0x010, ctype = 0x020,
16
  monetary = 0x040, numeric = 0x080,
17
  time = 0x100, messages = 0x200,
18
  all = collate | ctype | monetary | numeric | time | messages;
19
 
20
- // construct/copy/destroy:
21
  locale() noexcept;
22
  locale(const locale& other) noexcept;
23
  explicit locale(const char* std_name);
24
  explicit locale(const string& std_name);
25
  locale(const locale& other, const char* std_name, category);
@@ -28,21 +28,20 @@ namespace std {
28
  locale(const locale& other, const locale& one, category);
29
  ~locale(); // not virtual
30
  const locale& operator=(const locale& other) noexcept;
31
  template<class Facet> locale combine(const locale& other) const;
32
 
33
- // locale operations:
34
- basic_string<char> name() const;
35
 
36
  bool operator==(const locale& other) const;
37
- bool operator!=(const locale& other) const;
38
 
39
  template<class charT, class traits, class Allocator>
40
  bool operator()(const basic_string<charT, traits, Allocator>& s1,
41
  const basic_string<charT, traits, Allocator>& s2) const;
42
 
43
- // global locale objects:
44
  static locale global(const locale&);
45
  static const locale& classic();
46
  };
47
  }
48
  ```
@@ -63,29 +62,29 @@ An iostream `operator<<` might be implemented as:[^2]
63
  template<class charT, class traits>
64
  basic_ostream<charT, traits>&
65
  operator<< (basic_ostream<charT, traits>& s, Date d) {
66
  typename basic_ostream<charT, traits>::sentry cerberos(s);
67
  if (cerberos) {
68
- ios_base::iostate err = ios_base::iostate::goodbit;
69
  tm tmbuf; d.extract(tmbuf);
 
70
  use_facet<time_put<charT, ostreambuf_iterator<charT, traits>>>(
71
- s.getloc()).put(s, s, s.fill(), err, &tmbuf, 'x');
72
- s.setstate(err); // might throw
 
73
  }
74
  return s;
75
  }
76
  ```
77
 
78
  — *end example*]
79
 
80
  In the call to `use_facet<Facet>(loc)`, the type argument chooses a
81
  facet, making available all members of the named type. If `Facet` is not
82
- present in a locale, it throws the standard exception `bad_cast`. A
83
- C++program can check if a locale implements a particular facet with the
84
  function template `has_facet<Facet>()`. User-defined facets may be
85
- installed in a locale, and used identically as may standard facets (
86
- [[facets.examples]]).
87
 
88
  [*Note 1*:
89
 
90
  All locale semantics are accessed via `use_facet<>` and `has_facet<>`,
91
  except that:
@@ -95,11 +94,11 @@ except that:
95
  is provided so that a locale may be used as a predicate argument to
96
  the standard collections, to collate strings.
97
  - Convenient global interfaces are provided for traditional `ctype`
98
  functions such as `isdigit()` and `isspace()`, so that given a locale
99
  object `loc` a C++ program can call `isspace(c, loc)`. (This eases
100
- upgrading existing extractors ([[istream.formatted]]).)
101
 
102
  — *end note*]
103
 
104
  Once a facet reference is obtained from a locale object by calling
105
  `use_facet<>`, that reference remains usable, and the results from
@@ -117,14 +116,14 @@ of) itself. For an unnamed locale, `locale::name()` returns the string
117
 
118
  Whether there is one global locale object for the entire program or one
119
  global locale object per thread is *implementation-defined*.
120
  Implementations should provide one global locale object per thread. If
121
  there is a single global locale object for the entire program,
122
- implementations are not required to avoid data races on it (
123
- [[res.on.data.races]]).
124
 
125
- #### `locale` types <a id="locale.types">[[locale.types]]</a>
126
 
127
  ##### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
128
 
129
  ``` cpp
130
  using category = int;
@@ -149,22 +148,21 @@ category, represents the union of the two categories.
149
 
150
  member functions expecting a `category` argument require one of the
151
  `category` values defined above, or the union of two or more such
152
  values. Such a `category` value identifies a set of locale categories.
153
  Each locale category, in turn, identifies a set of locale facets,
154
- including at least those shown in Table 
155
- [[tab:localization.category.facets]].
156
 
157
- **Table: Locale category facets** <a id="tab:localization.category.facets">[tab:localization.category.facets]</a>
158
 
159
  | Category | Includes facets |
160
  | -------- | ----------------------------------------------------- |
161
  | collate | `collate<char>`, `collate<wchar_t>` |
162
  | ctype | `ctype<char>`, `ctype<wchar_t>` |
163
  | | `codecvt<char, char, mbstate_t>` |
164
- | | `codecvt<char16_t, char, mbstate_t>` |
165
- | | `codecvt<char32_t, char, mbstate_t>` |
166
  | | `codecvt<wchar_t, char, mbstate_t>` |
167
  | monetary | `moneypunct<char>`, `moneypunct<wchar_t>` |
168
  | | `moneypunct<char, true>`, `moneypunct<wchar_t, true>` |
169
  | | `money_get<char>`, `money_get<wchar_t>` |
170
  | | `money_put<char>`, `money_put<wchar_t>` |
@@ -175,28 +173,28 @@ including at least those shown in Table 
175
  | | `time_put<char>`, `time_put<wchar_t>` |
176
  | messages | `messages<char>`, `messages<wchar_t>` |
177
 
178
 
179
  For any locale `loc` either constructed, or returned by
180
- `locale::classic()`, and any facet `Facet` shown in Table 
181
- [[tab:localization.category.facets]], `has_facet<Facet>(loc)` is `true`.
182
- Each `locale` member function which takes a `locale::category` argument
183
  operates on the corresponding set of facets.
184
 
185
  An implementation is required to provide those specializations for facet
186
  templates identified as members of a category, and for those shown in
187
- Table  [[tab:localization.required.specializations]].
188
 
189
- **Table: Required specializations** <a id="tab:localization.required.specializations">[tab:localization.required.specializations]</a>
190
 
191
  | Category | Includes facets |
192
  | -------- | --------------------------------------------------------- |
193
  | collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
194
  | ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
195
  | | `codecvt_byname<char, char, mbstate_t>` |
196
- | | `codecvt_byname<char16_t, char, mbstate_t>` |
197
- | | `codecvt_byname<char32_t, char, mbstate_t>` |
198
  | | `codecvt_byname<wchar_t, char, mbstate_t>` |
199
  | monetary | `moneypunct_byname<char, International>` |
200
  | | `moneypunct_byname<wchar_t, International>` |
201
  | | `money_get<C, InputIterator>` |
202
  | | `money_put<C, OutputIterator>` |
@@ -219,18 +217,18 @@ The provided implementation of members of facets `num_get<charT>` and
219
  obtained by calling member `getloc()` on the `ios_base&` argument to
220
  these functions.
221
 
222
  In declarations of facets, a template parameter with name
223
  `InputIterator` or `OutputIterator` indicates the set of all possible
224
- specializations on parameters that satisfy the requirements of an Input
225
- Iterator or an Output Iterator, respectively (
226
- [[iterator.requirements]]). A template parameter with name `C`
227
- represents the set of types containing `char`, `wchar_t`, and any other
228
- *implementation-defined* character types that satisfy the requirements
229
- for a character on which any of the iostream components can be
230
- instantiated. A template parameter with name `International` represents
231
- the set of all possible specializations on a bool parameter.
232
 
233
  ##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
234
 
235
  ``` cpp
236
  namespace std {
@@ -256,11 +254,11 @@ static ::std::locale::id id;
256
  Template parameters in this Clause which are required to be facets are
257
  those named `Facet` in declarations. A program that passes a type that
258
  is *not* a facet, or a type that refers to a volatile-qualified facet,
259
  as an (explicit or deduced) template parameter to a locale function
260
  expecting a facet, is ill-formed. A const-qualified facet is a valid
261
- template argument to any locale function that expects a Facet template
262
  parameter.
263
 
264
  The `refs` argument to the constructor is used for lifetime management.
265
  For `refs == 0`, the implementation performs
266
  `delete static_cast<locale::facet*>(f)` (where `f` is a pointer to the
@@ -304,35 +302,27 @@ initialization.
304
  [*Note 1*: Because facets are used by iostreams, potentially while
305
  static constructors are running, their initialization cannot depend on
306
  programmed static initialization. One initialization strategy is for
307
  `locale` to initialize each facet’s `id` member the first time an
308
  instance of the facet is installed into a locale. This depends only on
309
- static storage being zero before constructors run (
310
- [[basic.start.static]]). — *end note*]
311
 
312
- #### `locale` constructors and destructor <a id="locale.cons">[[locale.cons]]</a>
313
 
314
  ``` cpp
315
  locale() noexcept;
316
  ```
317
 
318
- Default constructor: a snapshot of the current global locale.
319
-
320
  *Effects:* Constructs a copy of the argument last passed to
321
  `locale::global(locale&)`, if it has been called; else, the resulting
322
  facets have virtual function semantics identical to those of
323
  `locale::classic()`.
324
 
325
- [*Note 1*: This constructor is commonly used as the default value for
326
- arguments of functions that take a `const locale&`
327
- argument. — *end note*]
328
-
329
- ``` cpp
330
- locale(const locale& other) noexcept;
331
- ```
332
-
333
- *Effects:* Constructs a locale which is a copy of `other`.
334
 
335
  ``` cpp
336
  explicit locale(const char* std_name);
337
  ```
338
 
@@ -397,17 +387,11 @@ const locale& operator=(const locale& other) noexcept;
397
 
398
  *Effects:* Creates a copy of `other`, replacing the current value.
399
 
400
  *Returns:* `*this`.
401
 
402
- ``` cpp
403
- ~locale();
404
- ```
405
-
406
- A non-virtual destructor that throws no exceptions.
407
-
408
- #### `locale` members <a id="locale.members">[[locale.members]]</a>
409
 
410
  ``` cpp
411
  template<class Facet> locale combine(const locale& other) const;
412
  ```
413
 
@@ -419,43 +403,37 @@ except for that one facet of `other` that is identified by `Facet`.
419
  *Throws:* `runtime_error` if `has_facet<Facet>(other)` is `false`.
420
 
421
  *Remarks:* The resulting locale has no name.
422
 
423
  ``` cpp
424
- basic_string<char> name() const;
425
  ```
426
 
427
  *Returns:* The name of `*this`, if it has one; otherwise, the string
428
  `"*"`.
429
 
430
- #### `locale` operators <a id="locale.operators">[[locale.operators]]</a>
431
 
432
  ``` cpp
433
  bool operator==(const locale& other) const;
434
  ```
435
 
436
  *Returns:* `true` if both arguments are the same locale, or one is a
437
  copy of the other, or each has a name and the names are identical;
438
  `false` otherwise.
439
 
440
- ``` cpp
441
- bool operator!=(const locale& other) const;
442
- ```
443
-
444
- *Returns:* `!(*this == other)`.
445
-
446
  ``` cpp
447
  template<class charT, class traits, class Allocator>
448
  bool operator()(const basic_string<charT, traits, Allocator>& s1,
449
  const basic_string<charT, traits, Allocator>& s2) const;
450
  ```
451
 
452
  *Effects:* Compares two strings according to the `collate<charT>` facet.
453
 
454
  *Remarks:* This member operator template (and therefore `locale` itself)
455
- satisfies requirements for a comparator predicate template argument
456
- (Clause  [[algorithms]]) applied to strings.
457
 
458
  *Returns:*
459
 
460
  ``` cpp
461
  use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
@@ -471,28 +449,29 @@ locale `loc` simply by ([[alg.sort]], [[vector]]):
471
  std::sort(v.begin(), v.end(), loc);
472
  ```
473
 
474
  — *end example*]
475
 
476
- #### `locale` static members <a id="locale.statics">[[locale.statics]]</a>
477
 
478
  ``` cpp
479
  static locale global(const locale& loc);
480
  ```
481
 
482
- Sets the global locale to its argument.
483
-
484
- *Effects:* Causes future calls to the constructor `locale()` to return a
485
- copy of the argument. If the argument has a name, does
486
 
487
  ``` cpp
488
  setlocale(LC_ALL, loc.name().c_str());
489
  ```
490
 
491
  otherwise, the effect on the C locale, if any, is
492
- *implementation-defined*. No library function other than
493
- `locale::global()` shall affect the value returned by `locale()`.
 
 
494
 
495
  [*Note 1*: See  [[c.locales]] for data race considerations when
496
  `setlocale` is invoked. — *end note*]
497
 
498
  *Returns:* The previous value of `locale()`.
@@ -513,11 +492,11 @@ change with time.
513
 
514
  ``` cpp
515
  template<class Facet> const Facet& use_facet(const locale& loc);
516
  ```
517
 
518
- *Requires:* `Facet` is a facet class whose definition contains the
519
  public static member `id` as defined in  [[locale.facet]].
520
 
521
  *Returns:* A reference to the corresponding facet of `loc`, if present.
522
 
523
  *Throws:* `bad_cast` if `has_facet<Facet>(loc)` is `false`.
@@ -555,12 +534,12 @@ Each of these functions `isF` returns the result of the expression:
555
 
556
  ``` cpp
557
  use_facet<ctype<charT>>(loc).is(ctype_base::F, c)
558
  ```
559
 
560
- where `F` is the `ctype_base::mask` value corresponding to that
561
- function ([[category.ctype]]).[^4]
562
 
563
  #### Conversions <a id="conversions">[[conversions]]</a>
564
 
565
  ##### Character conversions <a id="conversions.character">[[conversions.character]]</a>
566
 
 
4
 
5
  ``` cpp
6
  namespace std {
7
  class locale {
8
  public:
9
+ // types
10
  class facet;
11
  class id;
12
  using category = int;
13
  static const category // values assigned here are for exposition only
14
  none = 0,
15
  collate = 0x010, ctype = 0x020,
16
  monetary = 0x040, numeric = 0x080,
17
  time = 0x100, messages = 0x200,
18
  all = collate | ctype | monetary | numeric | time | messages;
19
 
20
+ // construct/copy/destroy
21
  locale() noexcept;
22
  locale(const locale& other) noexcept;
23
  explicit locale(const char* std_name);
24
  explicit locale(const string& std_name);
25
  locale(const locale& other, const char* std_name, category);
 
28
  locale(const locale& other, const locale& one, category);
29
  ~locale(); // not virtual
30
  const locale& operator=(const locale& other) noexcept;
31
  template<class Facet> locale combine(const locale& other) const;
32
 
33
+ // locale operations
34
+ string name() const;
35
 
36
  bool operator==(const locale& other) const;
 
37
 
38
  template<class charT, class traits, class Allocator>
39
  bool operator()(const basic_string<charT, traits, Allocator>& s1,
40
  const basic_string<charT, traits, Allocator>& s2) const;
41
 
42
+ // global locale objects
43
  static locale global(const locale&);
44
  static const locale& classic();
45
  };
46
  }
47
  ```
 
62
  template<class charT, class traits>
63
  basic_ostream<charT, traits>&
64
  operator<< (basic_ostream<charT, traits>& s, Date d) {
65
  typename basic_ostream<charT, traits>::sentry cerberos(s);
66
  if (cerberos) {
 
67
  tm tmbuf; d.extract(tmbuf);
68
+ bool failed =
69
  use_facet<time_put<charT, ostreambuf_iterator<charT, traits>>>(
70
+ s.getloc()).put(s, s, s.fill(), &tmbuf, 'x').failed();
71
+ if (failed)
72
+ s.setstate(s.badbit); // might throw
73
  }
74
  return s;
75
  }
76
  ```
77
 
78
  — *end example*]
79
 
80
  In the call to `use_facet<Facet>(loc)`, the type argument chooses a
81
  facet, making available all members of the named type. If `Facet` is not
82
+ present in a locale, it throws the standard exception `bad_cast`. A C++
83
+ program can check if a locale implements a particular facet with the
84
  function template `has_facet<Facet>()`. User-defined facets may be
85
+ installed in a locale, and used identically as may standard facets.
 
86
 
87
  [*Note 1*:
88
 
89
  All locale semantics are accessed via `use_facet<>` and `has_facet<>`,
90
  except that:
 
94
  is provided so that a locale may be used as a predicate argument to
95
  the standard collections, to collate strings.
96
  - Convenient global interfaces are provided for traditional `ctype`
97
  functions such as `isdigit()` and `isspace()`, so that given a locale
98
  object `loc` a C++ program can call `isspace(c, loc)`. (This eases
99
+ upgrading existing extractors [[istream.formatted]].)
100
 
101
  — *end note*]
102
 
103
  Once a facet reference is obtained from a locale object by calling
104
  `use_facet<>`, that reference remains usable, and the results from
 
116
 
117
  Whether there is one global locale object for the entire program or one
118
  global locale object per thread is *implementation-defined*.
119
  Implementations should provide one global locale object per thread. If
120
  there is a single global locale object for the entire program,
121
+ implementations are not required to avoid data races on it
122
+ [[res.on.data.races]].
123
 
124
+ #### Types <a id="locale.types">[[locale.types]]</a>
125
 
126
  ##### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
127
 
128
  ``` cpp
129
  using category = int;
 
148
 
149
  member functions expecting a `category` argument require one of the
150
  `category` values defined above, or the union of two or more such
151
  values. Such a `category` value identifies a set of locale categories.
152
  Each locale category, in turn, identifies a set of locale facets,
153
+ including at least those shown in [[locale.category.facets]].
 
154
 
155
+ **Table: Locale category facets** <a id="locale.category.facets">[locale.category.facets]</a>
156
 
157
  | Category | Includes facets |
158
  | -------- | ----------------------------------------------------- |
159
  | collate | `collate<char>`, `collate<wchar_t>` |
160
  | ctype | `ctype<char>`, `ctype<wchar_t>` |
161
  | | `codecvt<char, char, mbstate_t>` |
162
+ | | `codecvt<char16_t, char8_t, mbstate_t>` |
163
+ | | `codecvt<char32_t, char8_t, mbstate_t>` |
164
  | | `codecvt<wchar_t, char, mbstate_t>` |
165
  | monetary | `moneypunct<char>`, `moneypunct<wchar_t>` |
166
  | | `moneypunct<char, true>`, `moneypunct<wchar_t, true>` |
167
  | | `money_get<char>`, `money_get<wchar_t>` |
168
  | | `money_put<char>`, `money_put<wchar_t>` |
 
173
  | | `time_put<char>`, `time_put<wchar_t>` |
174
  | messages | `messages<char>`, `messages<wchar_t>` |
175
 
176
 
177
  For any locale `loc` either constructed, or returned by
178
+ `locale::classic()`, and any facet `Facet` shown in
179
+ [[locale.category.facets]], `has_facet<Facet>(loc)` is `true`. Each
180
+ `locale` member function which takes a `locale::category` argument
181
  operates on the corresponding set of facets.
182
 
183
  An implementation is required to provide those specializations for facet
184
  templates identified as members of a category, and for those shown in
185
+ [[locale.spec]].
186
 
187
+ **Table: Required specializations** <a id="locale.spec">[locale.spec]</a>
188
 
189
  | Category | Includes facets |
190
  | -------- | --------------------------------------------------------- |
191
  | collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
192
  | ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
193
  | | `codecvt_byname<char, char, mbstate_t>` |
194
+ | | `codecvt_byname<char16_t, char8_t, mbstate_t>` |
195
+ | | `codecvt_byname<char32_t, char8_t, mbstate_t>` |
196
  | | `codecvt_byname<wchar_t, char, mbstate_t>` |
197
  | monetary | `moneypunct_byname<char, International>` |
198
  | | `moneypunct_byname<wchar_t, International>` |
199
  | | `money_get<C, InputIterator>` |
200
  | | `money_put<C, OutputIterator>` |
 
217
  obtained by calling member `getloc()` on the `ios_base&` argument to
218
  these functions.
219
 
220
  In declarations of facets, a template parameter with name
221
  `InputIterator` or `OutputIterator` indicates the set of all possible
222
+ specializations on parameters that meet the *Cpp17InputIterator*
223
+ requirements or *Cpp17OutputIterator* requirements, respectively
224
+ [[iterator.requirements]]. A template parameter with name `C` represents
225
+ the set of types containing `char`, `wchar_t`, and any other
226
+ *implementation-defined* character types that meet the requirements for
227
+ a character on which any of the iostream components can be instantiated.
228
+ A template parameter with name `International` represents the set of all
229
+ possible specializations on a bool parameter.
230
 
231
  ##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
232
 
233
  ``` cpp
234
  namespace std {
 
254
  Template parameters in this Clause which are required to be facets are
255
  those named `Facet` in declarations. A program that passes a type that
256
  is *not* a facet, or a type that refers to a volatile-qualified facet,
257
  as an (explicit or deduced) template parameter to a locale function
258
  expecting a facet, is ill-formed. A const-qualified facet is a valid
259
+ template argument to any locale function that expects a `Facet` template
260
  parameter.
261
 
262
  The `refs` argument to the constructor is used for lifetime management.
263
  For `refs == 0`, the implementation performs
264
  `delete static_cast<locale::facet*>(f)` (where `f` is a pointer to the
 
302
  [*Note 1*: Because facets are used by iostreams, potentially while
303
  static constructors are running, their initialization cannot depend on
304
  programmed static initialization. One initialization strategy is for
305
  `locale` to initialize each facet’s `id` member the first time an
306
  instance of the facet is installed into a locale. This depends only on
307
+ static storage being zero before constructors run
308
+ [[basic.start.static]]. — *end note*]
309
 
310
+ #### Constructors and destructor <a id="locale.cons">[[locale.cons]]</a>
311
 
312
  ``` cpp
313
  locale() noexcept;
314
  ```
315
 
 
 
316
  *Effects:* Constructs a copy of the argument last passed to
317
  `locale::global(locale&)`, if it has been called; else, the resulting
318
  facets have virtual function semantics identical to those of
319
  `locale::classic()`.
320
 
321
+ [*Note 1*: This constructor yields a copy of the current global locale.
322
+ It is commonly used as a default argument for function parameters of
323
+ type `const locale&`. — *end note*]
 
 
 
 
 
 
324
 
325
  ``` cpp
326
  explicit locale(const char* std_name);
327
  ```
328
 
 
387
 
388
  *Effects:* Creates a copy of `other`, replacing the current value.
389
 
390
  *Returns:* `*this`.
391
 
392
+ #### Members <a id="locale.members">[[locale.members]]</a>
 
 
 
 
 
 
393
 
394
  ``` cpp
395
  template<class Facet> locale combine(const locale& other) const;
396
  ```
397
 
 
403
  *Throws:* `runtime_error` if `has_facet<Facet>(other)` is `false`.
404
 
405
  *Remarks:* The resulting locale has no name.
406
 
407
  ``` cpp
408
+ string name() const;
409
  ```
410
 
411
  *Returns:* The name of `*this`, if it has one; otherwise, the string
412
  `"*"`.
413
 
414
+ #### Operators <a id="locale.operators">[[locale.operators]]</a>
415
 
416
  ``` cpp
417
  bool operator==(const locale& other) const;
418
  ```
419
 
420
  *Returns:* `true` if both arguments are the same locale, or one is a
421
  copy of the other, or each has a name and the names are identical;
422
  `false` otherwise.
423
 
 
 
 
 
 
 
424
  ``` cpp
425
  template<class charT, class traits, class Allocator>
426
  bool operator()(const basic_string<charT, traits, Allocator>& s1,
427
  const basic_string<charT, traits, Allocator>& s2) const;
428
  ```
429
 
430
  *Effects:* Compares two strings according to the `collate<charT>` facet.
431
 
432
  *Remarks:* This member operator template (and therefore `locale` itself)
433
+ meets the requirements for a comparator predicate template
434
+ argument [[algorithms]] applied to strings.
435
 
436
  *Returns:*
437
 
438
  ``` cpp
439
  use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
 
449
  std::sort(v.begin(), v.end(), loc);
450
  ```
451
 
452
  — *end example*]
453
 
454
+ #### Static members <a id="locale.statics">[[locale.statics]]</a>
455
 
456
  ``` cpp
457
  static locale global(const locale& loc);
458
  ```
459
 
460
+ *Effects:* Sets the global locale to its argument. Causes future calls
461
+ to the constructor `locale()` to return a copy of the argument. If the
462
+ argument has a name, does
 
463
 
464
  ``` cpp
465
  setlocale(LC_ALL, loc.name().c_str());
466
  ```
467
 
468
  otherwise, the effect on the C locale, if any, is
469
+ *implementation-defined*.
470
+
471
+ *Remarks:* No library function other than `locale::global()` affects the
472
+ value returned by `locale()`.
473
 
474
  [*Note 1*: See  [[c.locales]] for data race considerations when
475
  `setlocale` is invoked. — *end note*]
476
 
477
  *Returns:* The previous value of `locale()`.
 
492
 
493
  ``` cpp
494
  template<class Facet> const Facet& use_facet(const locale& loc);
495
  ```
496
 
497
+ *Mandates:* `Facet` is a facet class whose definition contains the
498
  public static member `id` as defined in  [[locale.facet]].
499
 
500
  *Returns:* A reference to the corresponding facet of `loc`, if present.
501
 
502
  *Throws:* `bad_cast` if `has_facet<Facet>(loc)` is `false`.
 
534
 
535
  ``` cpp
536
  use_facet<ctype<charT>>(loc).is(ctype_base::F, c)
537
  ```
538
 
539
+ where `F` is the `ctype_base::mask` value corresponding to that function
540
+ [[category.ctype]].[^4]
541
 
542
  #### Conversions <a id="conversions">[[conversions]]</a>
543
 
544
  ##### Character conversions <a id="conversions.character">[[conversions.character]]</a>
545