- tmp/tmp25k5dld8/{from.md → to.md} +242 -272
tmp/tmp25k5dld8/{from.md → to.md}
RENAMED
|
@@ -103,10 +103,12 @@ encapsulate and manipulate the information peculiar to a locale.[^1]
|
|
| 103 |
|
| 104 |
## Locales <a id="locales">[[locales]]</a>
|
| 105 |
|
| 106 |
### Class `locale` <a id="locale">[[locale]]</a>
|
| 107 |
|
|
|
|
|
|
|
| 108 |
``` cpp
|
| 109 |
namespace std {
|
| 110 |
class locale {
|
| 111 |
public:
|
| 112 |
// types
|
|
@@ -157,11 +159,11 @@ locale’s set of facets.
|
|
| 157 |
Access to the facets of a `locale` is via two function templates,
|
| 158 |
`use_facet<>` and `has_facet<>`.
|
| 159 |
|
| 160 |
[*Example 1*:
|
| 161 |
|
| 162 |
-
An iostream `operator<<`
|
| 163 |
|
| 164 |
``` cpp
|
| 165 |
template<class charT, class traits>
|
| 166 |
basic_ostream<charT, traits>&
|
| 167 |
operator<< (basic_ostream<charT, traits>& s, Date d) {
|
|
@@ -170,11 +172,11 @@ operator<< (basic_ostream<charT, traits>& s, Date d) {
|
|
| 170 |
tm tmbuf; d.extract(tmbuf);
|
| 171 |
bool failed =
|
| 172 |
use_facet<time_put<charT, ostreambuf_iterator<charT, traits>>>(
|
| 173 |
s.getloc()).put(s, s, s.fill(), &tmbuf, 'x').failed();
|
| 174 |
if (failed)
|
| 175 |
-
s.setstate(s.badbit); //
|
| 176 |
}
|
| 177 |
return s;
|
| 178 |
}
|
| 179 |
```
|
| 180 |
|
|
@@ -191,12 +193,15 @@ installed in a locale, and used identically as may standard facets.
|
|
| 191 |
|
| 192 |
All locale semantics are accessed via `use_facet<>` and `has_facet<>`,
|
| 193 |
except that:
|
| 194 |
|
| 195 |
- A member operator template
|
| 196 |
-
`
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
| 198 |
the standard collections, to collate strings.
|
| 199 |
- Convenient global interfaces are provided for traditional `ctype`
|
| 200 |
functions such as `isdigit()` and `isspace()`, so that given a locale
|
| 201 |
object `loc` a C++ program can call `isspace(c, loc)`. (This eases
|
| 202 |
upgrading existing extractors [[istream.formatted]].)
|
|
@@ -245,14 +250,12 @@ that the expression
|
|
| 245 |
|
| 246 |
is `true`, and represents the union of all categories. Further, the
|
| 247 |
expression `(X | Y)`, where `X` and `Y` each represent a single
|
| 248 |
category, represents the union of the two categories.
|
| 249 |
|
| 250 |
-
`locale`
|
| 251 |
-
|
| 252 |
-
member functions expecting a `category` argument require one of the
|
| 253 |
-
`category` values defined above, or the union of two or more such
|
| 254 |
values. Such a `category` value identifies a set of locale categories.
|
| 255 |
Each locale category, in turn, identifies a set of locale facets,
|
| 256 |
including at least those shown in [[locale.category.facets]].
|
| 257 |
|
| 258 |
**Table: Locale category facets** <a id="locale.category.facets">[locale.category.facets]</a>
|
|
@@ -369,11 +372,11 @@ facet) when the last `locale` object containing the facet is destroyed;
|
|
| 369 |
for `refs == 1`, the implementation never destroys the facet.
|
| 370 |
|
| 371 |
Constructors of all facets defined in this Clause take such an argument
|
| 372 |
and pass it along to their `facet` base class constructor. All
|
| 373 |
one-argument constructors defined in this Clause are *explicit*,
|
| 374 |
-
preventing their participation in
|
| 375 |
|
| 376 |
For some standard facets a standard “…`_byname`” class, derived from it,
|
| 377 |
implements the virtual function semantics equivalent to that facet of
|
| 378 |
the locale constructed by `locale(const char*)` with the same name. Each
|
| 379 |
such facet provides a constructor that takes a `const char*` argument,
|
|
@@ -440,51 +443,59 @@ any *implementation-defined* values.
|
|
| 440 |
|
| 441 |
``` cpp
|
| 442 |
explicit locale(const string& std_name);
|
| 443 |
```
|
| 444 |
|
| 445 |
-
*Effects:*
|
| 446 |
|
| 447 |
``` cpp
|
| 448 |
-
locale(const locale& other, const char* std_name, category);
|
| 449 |
```
|
| 450 |
|
|
|
|
|
|
|
| 451 |
*Effects:* Constructs a locale as a copy of `other` except for the
|
| 452 |
facets identified by the `category` argument, which instead implement
|
| 453 |
the same semantics as `locale(std_name)`.
|
| 454 |
|
| 455 |
-
*Throws:* `runtime_error` if the argument is not valid, or is
|
|
|
|
| 456 |
|
| 457 |
*Remarks:* The locale has a name if and only if `other` has a name.
|
| 458 |
|
| 459 |
``` cpp
|
| 460 |
-
locale(const locale& other, const string& std_name, category
|
| 461 |
```
|
| 462 |
|
| 463 |
-
*Effects:*
|
| 464 |
|
| 465 |
``` cpp
|
| 466 |
template<class Facet> locale(const locale& other, Facet* f);
|
| 467 |
```
|
| 468 |
|
| 469 |
*Effects:* Constructs a locale incorporating all facets from the first
|
| 470 |
argument except that of type `Facet`, and installs the second argument
|
| 471 |
as the remaining facet. If `f` is null, the resulting object is a copy
|
| 472 |
of `other`.
|
| 473 |
|
| 474 |
-
*Remarks:*
|
|
|
|
| 475 |
|
| 476 |
``` cpp
|
| 477 |
locale(const locale& other, const locale& one, category cats);
|
| 478 |
```
|
| 479 |
|
|
|
|
|
|
|
| 480 |
*Effects:* Constructs a locale incorporating all facets from the first
|
| 481 |
argument except those that implement `cats`, which are instead
|
| 482 |
incorporated from the second argument.
|
| 483 |
|
| 484 |
-
*Remarks:*
|
| 485 |
-
|
|
|
|
|
|
|
| 486 |
|
| 487 |
``` cpp
|
| 488 |
const locale& operator=(const locale& other) noexcept;
|
| 489 |
```
|
| 490 |
|
|
@@ -530,25 +541,25 @@ template<class charT, class traits, class Allocator>
|
|
| 530 |
const basic_string<charT, traits, Allocator>& s2) const;
|
| 531 |
```
|
| 532 |
|
| 533 |
*Effects:* Compares two strings according to the `collate<charT>` facet.
|
| 534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 535 |
*Remarks:* This member operator template (and therefore `locale` itself)
|
| 536 |
meets the requirements for a comparator predicate template
|
| 537 |
argument [[algorithms]] applied to strings.
|
| 538 |
|
| 539 |
-
*Returns:*
|
| 540 |
-
|
| 541 |
-
``` cpp
|
| 542 |
-
use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
|
| 543 |
-
s2.data(), s2.data() + s2.size()) < 0
|
| 544 |
-
```
|
| 545 |
-
|
| 546 |
[*Example 1*:
|
| 547 |
|
| 548 |
A vector of strings `v` can be collated according to collation rules in
|
| 549 |
-
locale `loc` simply by
|
| 550 |
|
| 551 |
``` cpp
|
| 552 |
std::sort(v.begin(), v.end(), loc);
|
| 553 |
```
|
| 554 |
|
|
@@ -569,18 +580,18 @@ setlocale(LC_ALL, loc.name().c_str());
|
|
| 569 |
```
|
| 570 |
|
| 571 |
otherwise, the effect on the C locale, if any, is
|
| 572 |
*implementation-defined*.
|
| 573 |
|
|
|
|
|
|
|
| 574 |
*Remarks:* No library function other than `locale::global()` affects the
|
| 575 |
value returned by `locale()`.
|
| 576 |
|
| 577 |
[*Note 1*: See [[c.locales]] for data race considerations when
|
| 578 |
`setlocale` is invoked. — *end note*]
|
| 579 |
|
| 580 |
-
*Returns:* The previous value of `locale()`.
|
| 581 |
-
|
| 582 |
``` cpp
|
| 583 |
static const locale& classic();
|
| 584 |
```
|
| 585 |
|
| 586 |
The `"C"` locale.
|
|
@@ -640,13 +651,11 @@ use_facet<ctype<charT>>(loc).is(ctype_base::F, c)
|
|
| 640 |
```
|
| 641 |
|
| 642 |
where `F` is the `ctype_base::mask` value corresponding to that function
|
| 643 |
[[category.ctype]].[^4]
|
| 644 |
|
| 645 |
-
####
|
| 646 |
-
|
| 647 |
-
##### Character conversions <a id="conversions.character">[[conversions.character]]</a>
|
| 648 |
|
| 649 |
``` cpp
|
| 650 |
template<class charT> charT toupper(charT c, const locale& loc);
|
| 651 |
```
|
| 652 |
|
|
@@ -658,10 +667,12 @@ template<class charT> charT tolower(charT c, const locale& loc);
|
|
| 658 |
|
| 659 |
*Returns:* `use_facet<ctype<charT>>(loc).tolower(c)`.
|
| 660 |
|
| 661 |
## Standard `locale` categories <a id="locale.categories">[[locale.categories]]</a>
|
| 662 |
|
|
|
|
|
|
|
| 663 |
Each of the standard categories includes a family of facets. Some of
|
| 664 |
these implement formatting or parsing of a datum, for use by standard or
|
| 665 |
users’ iostream operators `<<` and `>>`, as members `put()` and `get()`,
|
| 666 |
respectively. Each such member function takes an `ios_base&` argument
|
| 667 |
whose members `flags()`, `precision()`, and `width()`, specify the
|
|
@@ -674,15 +685,17 @@ The `put()` members make no provision for error reporting. (Any failures
|
|
| 674 |
of the OutputIterator argument can be extracted from the returned
|
| 675 |
iterator.) The `get()` members take an `ios_base::iostate&` argument
|
| 676 |
whose value they ignore, but set to `ios_base::failbit` in case of a
|
| 677 |
parse error.
|
| 678 |
|
| 679 |
-
Within
|
| 680 |
-
another virtual function.
|
| 681 |
|
| 682 |
### The `ctype` category <a id="category.ctype">[[category.ctype]]</a>
|
| 683 |
|
|
|
|
|
|
|
| 684 |
``` cpp
|
| 685 |
namespace std {
|
| 686 |
class ctype_base {
|
| 687 |
public:
|
| 688 |
using mask = see below;
|
|
@@ -706,10 +719,12 @@ namespace std {
|
|
| 706 |
|
| 707 |
The type `mask` is a bitmask type [[bitmask.types]].
|
| 708 |
|
| 709 |
#### Class template `ctype` <a id="locale.ctype">[[locale.ctype]]</a>
|
| 710 |
|
|
|
|
|
|
|
| 711 |
``` cpp
|
| 712 |
namespace std {
|
| 713 |
template<class charT>
|
| 714 |
class ctype : public locale::facet, public ctype_base {
|
| 715 |
public:
|
|
@@ -879,12 +894,14 @@ charT do_widen(char c) const;
|
|
| 879 |
const char* do_widen(const char* low, const char* high, charT* dest) const;
|
| 880 |
```
|
| 881 |
|
| 882 |
*Effects:* Applies the simplest reasonable transformation from a `char`
|
| 883 |
value or sequence of `char` values to the corresponding `charT` value or
|
| 884 |
-
values.[^5]
|
| 885 |
-
|
|
|
|
|
|
|
| 886 |
|
| 887 |
For any named `ctype` category with a `ctype<charT>` facet `ctc` and
|
| 888 |
valid `ctype_base::mask` value `M`,
|
| 889 |
`(ctc.is(M, c) || !is(M, do_widen(c)) )` is `true`.[^6]
|
| 890 |
|
|
@@ -901,12 +918,12 @@ const charT* do_narrow(const charT* low, const charT* high, char dfault, char* d
|
|
| 901 |
|
| 902 |
*Effects:* Applies the simplest reasonable transformation from a `charT`
|
| 903 |
value or sequence of `charT` values to the corresponding `char` value or
|
| 904 |
values.
|
| 905 |
|
| 906 |
-
For any character `c` in the basic
|
| 907 |
-
|
| 908 |
|
| 909 |
``` cpp
|
| 910 |
do_widen(do_narrow(c, 0)) == c
|
| 911 |
```
|
| 912 |
|
|
@@ -944,10 +961,12 @@ namespace std {
|
|
| 944 |
}
|
| 945 |
```
|
| 946 |
|
| 947 |
#### `ctype<char>` specialization <a id="facet.ctype.special">[[facet.ctype.special]]</a>
|
| 948 |
|
|
|
|
|
|
|
| 949 |
``` cpp
|
| 950 |
namespace std {
|
| 951 |
template<>
|
| 952 |
class ctype<char> : public locale::facet, public ctype_base {
|
| 953 |
public:
|
|
@@ -991,12 +1010,14 @@ namespace std {
|
|
| 991 |
};
|
| 992 |
}
|
| 993 |
```
|
| 994 |
|
| 995 |
A specialization `ctype<char>` is provided so that the member functions
|
| 996 |
-
on type `char` can be implemented inline.[^7]
|
| 997 |
-
|
|
|
|
|
|
|
| 998 |
|
| 999 |
##### Destructor <a id="facet.ctype.char.dtor">[[facet.ctype.char.dtor]]</a>
|
| 1000 |
|
| 1001 |
``` cpp
|
| 1002 |
~ctype();
|
|
@@ -1120,10 +1141,12 @@ virtual const char* do_narrow(const char* low, const char* high,
|
|
| 1120 |
These functions are described identically as those members of the same
|
| 1121 |
name in the `ctype` class template [[locale.ctype.members]].
|
| 1122 |
|
| 1123 |
#### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
|
| 1124 |
|
|
|
|
|
|
|
| 1125 |
``` cpp
|
| 1126 |
namespace std {
|
| 1127 |
class codecvt_base {
|
| 1128 |
public:
|
| 1129 |
enum result { ok, partial, error, noconv };
|
|
@@ -1192,19 +1215,19 @@ mapped between.
|
|
| 1192 |
The specializations required in [[locale.category.facets]]
|
| 1193 |
[[locale.category]] convert the implementation-defined native character
|
| 1194 |
set. `codecvt<char, char, mbstate_t>` implements a degenerate
|
| 1195 |
conversion; it does not convert at all. The specialization
|
| 1196 |
`codecvt<char16_t, char8_t, mbstate_t>` converts between the UTF-16 and
|
| 1197 |
-
UTF-8 encoding forms, and the specialization
|
| 1198 |
-
`<char32_t, char8_t, mbstate_t>` converts between the UTF-32 and
|
| 1199 |
-
encoding forms. `codecvt<wchar_t, char, mbstate_t>` converts
|
| 1200 |
-
native character sets for ordinary and wide characters.
|
| 1201 |
-
on `mbstate_t` perform conversion between encodings
|
| 1202 |
-
implementer. Other encodings can be converted by
|
| 1203 |
-
program-defined `stateT` type. Objects of type
|
| 1204 |
-
state that is useful to communicate to or from
|
| 1205 |
-
or `do_out` members.
|
| 1206 |
|
| 1207 |
##### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
|
| 1208 |
|
| 1209 |
``` cpp
|
| 1210 |
result out(
|
|
@@ -1317,44 +1340,45 @@ shall also return `ok`.[^8]
|
|
| 1317 |
|
| 1318 |
[*Note 1*: As a result of operations on `state`, it can return `ok` or
|
| 1319 |
`partial` and set `from_next == from` and
|
| 1320 |
`to_next != to`. — *end note*]
|
| 1321 |
|
| 1322 |
-
*Remarks:* Its operations on `state` are unspecified.
|
| 1323 |
-
|
| 1324 |
-
[*Note 2*: This argument can be used, for example, to maintain shift
|
| 1325 |
-
state, to specify conversion options (such as count only), or to
|
| 1326 |
-
identify a cache of seek offsets. — *end note*]
|
| 1327 |
-
|
| 1328 |
*Returns:* An enumeration value, as summarized in
|
| 1329 |
[[locale.codecvt.inout]].
|
| 1330 |
|
| 1331 |
**Table: `do_in/do_out` result values** <a id="locale.codecvt.inout">[locale.codecvt.inout]</a>
|
| 1332 |
|
| 1333 |
| Value | Meaning |
|
| 1334 |
| --------- | ------------------------------------------------------------------------------------------------ |
|
| 1335 |
| `ok` | completed the conversion |
|
| 1336 |
| `partial` | not all source characters converted |
|
| 1337 |
-
| `error` | encountered a character in {[}`from`, `from_end`{)} that
|
| 1338 |
| `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
|
| 1339 |
|
| 1340 |
|
| 1341 |
A return value of `partial`, if `(from_next == from_end)`, indicates
|
| 1342 |
that either the destination sequence has not absorbed all the available
|
| 1343 |
destination elements, or that additional source elements are needed
|
| 1344 |
before another destination element can be produced.
|
| 1345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1346 |
``` cpp
|
| 1347 |
result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
|
| 1348 |
```
|
| 1349 |
|
| 1350 |
*Preconditions:* `(to <= to_end)` is well-defined and `true`; `state` is
|
| 1351 |
initialized, if at the beginning of a sequence, or else is equal to the
|
| 1352 |
result of converting the preceding characters in the sequence.
|
| 1353 |
|
| 1354 |
*Effects:* Places characters starting at `to` that should be appended to
|
| 1355 |
terminate a sequence when the current `stateT` is given by `state`.[^9]
|
|
|
|
| 1356 |
Stores no more than `(to_end - to)` destination elements, and leaves the
|
| 1357 |
`to_next` pointer pointing one beyond the last element successfully
|
| 1358 |
stored.
|
| 1359 |
|
| 1360 |
*Returns:* An enumeration value, as summarized in
|
|
@@ -1430,10 +1454,12 @@ namespace std {
|
|
| 1430 |
}
|
| 1431 |
```
|
| 1432 |
|
| 1433 |
### The numeric category <a id="category.numeric">[[category.numeric]]</a>
|
| 1434 |
|
|
|
|
|
|
|
| 1435 |
The classes `num_get<>` and `num_put<>` handle numeric formatting and
|
| 1436 |
parsing. Virtual functions are provided for several numeric types.
|
| 1437 |
Implementations may (but are not required to) delegate extraction of
|
| 1438 |
smaller types to extractors for larger types.[^11]
|
| 1439 |
|
|
@@ -1448,14 +1474,16 @@ specifications [[locale.categories]], and to its imbued locale for the
|
|
| 1448 |
`numpunct<>` facet to identify all numeric punctuation preferences, and
|
| 1449 |
also for the `ctype<>` facet to perform character classification.
|
| 1450 |
|
| 1451 |
Extractor and inserter members of the standard iostreams use `num_get<>`
|
| 1452 |
and `num_put<>` member functions for formatting and parsing numeric
|
| 1453 |
-
values
|
| 1454 |
|
| 1455 |
#### Class template `num_get` <a id="locale.num.get">[[locale.num.get]]</a>
|
| 1456 |
|
|
|
|
|
|
|
| 1457 |
``` cpp
|
| 1458 |
namespace std {
|
| 1459 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 1460 |
class num_get : public locale::facet {
|
| 1461 |
public:
|
|
@@ -1586,129 +1614,27 @@ The details of this operation occur in three stages
|
|
| 1586 |
determined in stage 1.
|
| 1587 |
- Stage 3: Store results
|
| 1588 |
|
| 1589 |
The details of the stages are presented below.
|
| 1590 |
|
| 1591 |
-
|
| 1592 |
|
| 1593 |
-
|
| 1594 |
|
| 1595 |
-
```
|
| 1596 |
-
|
| 1597 |
-
|
| 1598 |
-
|
| 1599 |
-
|
| 1600 |
-
``
|
| 1601 |
|
| 1602 |
-
|
| 1603 |
-
conversion specifier as indicated in [[facet.num.get.int]]. The
|
| 1604 |
-
table is ordered. That is, the first line whose condition is true
|
| 1605 |
-
applies.
|
| 1606 |
|
| 1607 |
-
|
| 1608 |
-
|
| 1609 |
-
| State | `stdio` equivalent |
|
| 1610 |
-
| ------------------------ | ------------------ |
|
| 1611 |
-
| `basefield == oct` | `%o` |
|
| 1612 |
-
| `basefield == hex` | `%X` |
|
| 1613 |
-
| `basefield == 0` | `%i` `signed` integral type | `%d` |
|
| 1614 |
-
| `unsigned` integral type | `%u` |
|
| 1615 |
-
|
| 1616 |
-
|
| 1617 |
-
For conversions to a floating-point type the specifier is `%g`.
|
| 1618 |
-
|
| 1619 |
-
For conversions to `void*` the specifier is `%p`.
|
| 1620 |
-
|
| 1621 |
-
A length modifier is added to the conversion specification, if needed,
|
| 1622 |
-
as indicated in [[facet.num.get.length]].
|
| 1623 |
-
|
| 1624 |
-
**Table: Length modifier** <a id="facet.num.get.length">[facet.num.get.length]</a>
|
| 1625 |
-
|
| 1626 |
-
| Type | Length modifier |
|
| 1627 |
-
| -------------------- | --------------- |
|
| 1628 |
-
| `short` | `h` |
|
| 1629 |
-
| `unsigned short` | `h` |
|
| 1630 |
-
| `long` | `l` |
|
| 1631 |
-
| `unsigned long` | `l` |
|
| 1632 |
-
| `long long` | `ll` |
|
| 1633 |
-
| `unsigned long long` | `ll` |
|
| 1634 |
-
| `double` | `l` |
|
| 1635 |
-
| `long double` | `L` |
|
| 1636 |
-
|
| 1637 |
-
- **Stage 2:**
|
| 1638 |
-
|
| 1639 |
-
If `in == end` then stage 2 terminates. Otherwise a `charT` is taken
|
| 1640 |
-
from `in` and local variables are initialized as if by
|
| 1641 |
-
|
| 1642 |
-
``` cpp
|
| 1643 |
-
char_type ct = *in;
|
| 1644 |
-
char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
|
| 1645 |
-
if (ct == use_facet<numpunct<charT>>(loc).decimal_point())
|
| 1646 |
-
c = '.';
|
| 1647 |
-
bool discard =
|
| 1648 |
-
ct == use_facet<numpunct<charT>>(loc).thousands_sep()
|
| 1649 |
-
&& use_facet<numpunct<charT>>(loc).grouping().length() != 0;
|
| 1650 |
-
```
|
| 1651 |
-
|
| 1652 |
-
where the values `src` and `atoms` are defined as if by:
|
| 1653 |
-
|
| 1654 |
-
``` cpp
|
| 1655 |
-
static const char src[] = "0123456789abcdefxABCDEFX+-";
|
| 1656 |
-
char_type atoms[sizeof(src)];
|
| 1657 |
-
use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
|
| 1658 |
-
```
|
| 1659 |
-
|
| 1660 |
-
for this value of `loc`.
|
| 1661 |
-
|
| 1662 |
-
If `discard` is `true`, then if `’.’` has not yet been accumulated, then
|
| 1663 |
-
the position of the character is remembered, but the character is
|
| 1664 |
-
otherwise ignored. Otherwise, if `’.’` has already been accumulated, the
|
| 1665 |
-
character is discarded and Stage 2 terminates. If it is not discarded,
|
| 1666 |
-
then a check is made to determine if `c` is allowed as the next
|
| 1667 |
-
character of an input field of the conversion specifier returned by
|
| 1668 |
-
Stage 1. If so, it is accumulated.
|
| 1669 |
-
|
| 1670 |
-
If the character is either discarded or accumulated then `in` is
|
| 1671 |
-
advanced by `++in` and processing returns to the beginning of stage 2.
|
| 1672 |
-
|
| 1673 |
-
- **Stage 3:**
|
| 1674 |
-
|
| 1675 |
-
The sequence of `char`s accumulated in stage 2 (the field) is converted
|
| 1676 |
-
to a numeric value by the rules of one of the functions declared in the
|
| 1677 |
-
header `<cstdlib>`:
|
| 1678 |
-
|
| 1679 |
-
- For a signed integer value, the function `strtoll`.
|
| 1680 |
-
|
| 1681 |
-
- For an unsigned integer value, the function `strtoull`.
|
| 1682 |
-
|
| 1683 |
-
- For a `float` value, the function `strtof`.
|
| 1684 |
-
|
| 1685 |
-
- For a `double` value, the function `strtod`.
|
| 1686 |
-
|
| 1687 |
-
- For a `long double` value, the function `strtold`.
|
| 1688 |
-
|
| 1689 |
-
The numeric value to be stored can be one of:
|
| 1690 |
-
|
| 1691 |
-
- zero, if the conversion function does not convert the entire field.
|
| 1692 |
-
|
| 1693 |
-
- the most positive (or negative) representable value, if the field to
|
| 1694 |
-
be converted to a signed integer type represents a value too large
|
| 1695 |
-
positive (or negative) to be represented in `val`.
|
| 1696 |
-
|
| 1697 |
-
- the most positive representable value, if the field to be converted to
|
| 1698 |
-
an unsigned integer type represents a value that cannot be represented
|
| 1699 |
-
in `val`.
|
| 1700 |
-
|
| 1701 |
-
- the converted value, otherwise.
|
| 1702 |
-
|
| 1703 |
-
The resultant numeric value is stored in `val`. If the conversion
|
| 1704 |
-
function does not convert the entire field, or if the field represents a
|
| 1705 |
-
value outside the range of representable values, `ios_base::failbit` is
|
| 1706 |
-
assigned to `err`.
|
| 1707 |
|
| 1708 |
Digit grouping is checked. That is, the positions of discarded
|
| 1709 |
-
separators
|
| 1710 |
`use_facet<numpunct<charT>>(loc).grouping()`. If they are not consistent
|
| 1711 |
then `ios_base::failbit` is assigned to `err`.
|
| 1712 |
|
| 1713 |
In any case, if stage 2 processing was terminated by the test for
|
| 1714 |
`in == end` then `err |= ios_base::eofbit` is performed.
|
|
@@ -1741,11 +1667,11 @@ character successfully matched. If `val` is set, then `err` is set to
|
|
| 1741 |
`str.goodbit`; or to `str.eofbit` if, when seeking another character to
|
| 1742 |
match, it is found that `(in == end)`. If `val` is not set, then `err`
|
| 1743 |
is set to `str.failbit`; or to `(str.failbit|str.eofbit)` if the reason
|
| 1744 |
for the failure was that `(in == end)`.
|
| 1745 |
|
| 1746 |
-
[*Example
|
| 1747 |
sequence `"a"` yields `val == true` and `err == str.eofbit`; the input
|
| 1748 |
sequence `"abc"` yields `err = str.failbit`, with `in` ending at the
|
| 1749 |
`’c’` element. For targets `true`: `"1"` and `false`: `"0"`, the input
|
| 1750 |
sequence `"1"` yields `val == true` and `err == str.goodbit`. For empty
|
| 1751 |
targets `("")`, any input sequence yields
|
|
@@ -1753,10 +1679,12 @@ targets `("")`, any input sequence yields
|
|
| 1753 |
|
| 1754 |
*Returns:* `in`.
|
| 1755 |
|
| 1756 |
#### Class template `num_put` <a id="locale.nm.put">[[locale.nm.put]]</a>
|
| 1757 |
|
|
|
|
|
|
|
| 1758 |
``` cpp
|
| 1759 |
namespace std {
|
| 1760 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 1761 |
class num_put : public locale::facet {
|
| 1762 |
public:
|
|
@@ -1956,24 +1884,25 @@ const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
|
|
| 1956 |
```
|
| 1957 |
|
| 1958 |
For arithmetic types, `punct.thousands_sep()` characters are inserted
|
| 1959 |
into the sequence as determined by the value returned by
|
| 1960 |
`punct.do_grouping()` using the method described
|
| 1961 |
-
in [[facet.numpunct.virtuals]]
|
| 1962 |
|
| 1963 |
-
Decimal point characters(.) are replaced by `punct.decimal_point()`
|
| 1964 |
|
| 1965 |
- **Stage 3:**
|
| 1966 |
|
| 1967 |
A local variable is initialized as
|
| 1968 |
|
| 1969 |
``` cpp
|
| 1970 |
fmtflags adjustfield = (flags & (ios_base::adjustfield));
|
| 1971 |
```
|
| 1972 |
|
| 1973 |
-
The location of any padding[^12]
|
| 1974 |
-
|
|
|
|
| 1975 |
|
| 1976 |
**Table: Fill padding** <a id="facet.num.put.fill">[facet.num.put.fill]</a>
|
| 1977 |
|
| 1978 |
| State | Location |
|
| 1979 |
| ------------------------------------------------------------------------------ | ------------------ |
|
|
@@ -2018,10 +1947,12 @@ and returns `out`.
|
|
| 2018 |
|
| 2019 |
### The numeric punctuation facet <a id="facet.numpunct">[[facet.numpunct]]</a>
|
| 2020 |
|
| 2021 |
#### Class template `numpunct` <a id="locale.numpunct">[[locale.numpunct]]</a>
|
| 2022 |
|
|
|
|
|
|
|
| 2023 |
``` cpp
|
| 2024 |
namespace std {
|
| 2025 |
template<class charT>
|
| 2026 |
class numpunct : public locale::facet {
|
| 2027 |
public:
|
|
@@ -2047,14 +1978,12 @@ namespace std {
|
|
| 2047 |
virtual string_type do_falsename() const; // for bool
|
| 2048 |
};
|
| 2049 |
}
|
| 2050 |
```
|
| 2051 |
|
| 2052 |
-
`numpunct<>`
|
| 2053 |
-
|
| 2054 |
-
specifies numeric punctuation. The specializations required in
|
| 2055 |
-
[[locale.category.facets]] [[locale.category]], namely
|
| 2056 |
`numpunct<{}wchar_t>` and `numpunct<char>`, provide classic `"C"`
|
| 2057 |
numeric formats, i.e., they contain information equivalent to that
|
| 2058 |
contained in the `"C"` locale or their wide character counterparts as if
|
| 2059 |
obtained by a call to `widen`.
|
| 2060 |
|
|
@@ -2159,14 +2088,15 @@ required specializations return `’,’` or `L’,’`.
|
|
| 2159 |
``` cpp
|
| 2160 |
string do_grouping() const;
|
| 2161 |
```
|
| 2162 |
|
| 2163 |
*Returns:* A `string` `vec` used as a vector of integer values, in which
|
| 2164 |
-
each element `vec[i]` represents the number of digits[^13]
|
| 2165 |
-
|
| 2166 |
-
|
| 2167 |
-
|
|
|
|
| 2168 |
group is unlimited.
|
| 2169 |
|
| 2170 |
The required specializations return the empty string, indicating no
|
| 2171 |
grouping.
|
| 2172 |
|
|
@@ -2203,10 +2133,12 @@ namespace std {
|
|
| 2203 |
|
| 2204 |
### The collate category <a id="category.collate">[[category.collate]]</a>
|
| 2205 |
|
| 2206 |
#### Class template `collate` <a id="locale.collate">[[locale.collate]]</a>
|
| 2207 |
|
|
|
|
|
|
|
| 2208 |
``` cpp
|
| 2209 |
namespace std {
|
| 2210 |
template<class charT>
|
| 2211 |
class collate : public locale::facet {
|
| 2212 |
public:
|
|
@@ -2236,11 +2168,11 @@ The class `collate<charT>` provides features for use in the collation
|
|
| 2236 |
(comparison) and hashing of strings. A locale member function template,
|
| 2237 |
`operator()`, uses the collate facet to allow a locale to act directly
|
| 2238 |
as the predicate argument for standard algorithms [[algorithms]] and
|
| 2239 |
containers operating on strings. The specializations required in
|
| 2240 |
[[locale.category.facets]] [[locale.category]], namely `collate<char>`
|
| 2241 |
-
and `collate<wchar_t>`, apply
|
| 2242 |
[[alg.lex.comparison]].
|
| 2243 |
|
| 2244 |
Each function compares a string of characters `*p` in the range \[`low`,
|
| 2245 |
`high`).
|
| 2246 |
|
|
@@ -2293,13 +2225,13 @@ long do_hash(const charT* low, const charT* high) const;
|
|
| 2293 |
|
| 2294 |
*Returns:* An integer value equal to the result of calling `hash()` on
|
| 2295 |
any other string for which `do_compare()` returns 0 (equal) when passed
|
| 2296 |
the two strings.
|
| 2297 |
|
| 2298 |
-
|
| 2299 |
-
string which does not compare equal should be very small,
|
| 2300 |
-
`(1.0/numeric_limits<unsigned long>::max())`.
|
| 2301 |
|
| 2302 |
#### Class template `collate_byname` <a id="locale.collate.byname">[[locale.collate.byname]]</a>
|
| 2303 |
|
| 2304 |
``` cpp
|
| 2305 |
namespace std {
|
|
@@ -2317,10 +2249,12 @@ namespace std {
|
|
| 2317 |
}
|
| 2318 |
```
|
| 2319 |
|
| 2320 |
### The time category <a id="category.time">[[category.time]]</a>
|
| 2321 |
|
|
|
|
|
|
|
| 2322 |
Templates `time_get<charT, InputIterator>` and
|
| 2323 |
`time_put<charT, OutputIterator>` provide date and time formatting and
|
| 2324 |
parsing. All specifications of member functions for `time_put` and
|
| 2325 |
`time_get` in the subclauses of [[category.time]] only apply to the
|
| 2326 |
specializations required in Tables [[tab:locale.category.facets]] and
|
|
@@ -2329,10 +2263,12 @@ specializations required in Tables [[tab:locale.category.facets]] and
|
|
| 2329 |
[[locale.categories]], and the `ctype<>` facet, to determine formatting
|
| 2330 |
details.
|
| 2331 |
|
| 2332 |
#### Class template `time_get` <a id="locale.time.get">[[locale.time.get]]</a>
|
| 2333 |
|
|
|
|
|
|
|
| 2334 |
``` cpp
|
| 2335 |
namespace std {
|
| 2336 |
class time_base {
|
| 2337 |
public:
|
| 2338 |
enum dateorder { no_order, dmy, mdy, ymd, ydm };
|
|
@@ -2382,19 +2318,17 @@ namespace std {
|
|
| 2382 |
ios_base::iostate& err, tm* t, char format, char modifier) const;
|
| 2383 |
};
|
| 2384 |
}
|
| 2385 |
```
|
| 2386 |
|
| 2387 |
-
`time_get`
|
| 2388 |
-
|
| 2389 |
-
|
| 2390 |
-
or date into a `struct tm` object. Each `get` member parses a format as
|
| 2391 |
-
produced by a corresponding format specifier to `time_put<>::put`. If
|
| 2392 |
the sequence being parsed matches the correct format, the corresponding
|
| 2393 |
-
members of the `
|
| 2394 |
-
|
| 2395 |
-
|
| 2396 |
|
| 2397 |
If the end iterator is reached during parsing by any of the `get()`
|
| 2398 |
member functions, the member sets `ios_base::eofbit` in `err`.
|
| 2399 |
|
| 2400 |
##### Members <a id="locale.time.get.members">[[locale.time.get.members]]</a>
|
|
@@ -2460,12 +2394,12 @@ the first of the following conditions holds:
|
|
| 2460 |
- The expression `s == end` evaluates to `true`, in which case the
|
| 2461 |
function evaluates `err = ios_base::eofbit | ios_base::failbit`.
|
| 2462 |
- The next element of `fmt` is equal to `’%’`, optionally followed by a
|
| 2463 |
modifier character, followed by a conversion specifier character,
|
| 2464 |
`format`, together forming a conversion specification valid for the
|
| 2465 |
-
|
| 2466 |
-
|
| 2467 |
whether the conversion specification is complete and valid, the
|
| 2468 |
function evaluates `err = ios_base::failbit`. Otherwise, the function
|
| 2469 |
evaluates `s = do_get(s, end, f, err, t, format, modifier)`, where the
|
| 2470 |
value of `modifier` is `’\0’` when the optional modifier is absent
|
| 2471 |
from the conversion specification. If `err == ios_base::goodbit` holds
|
|
@@ -2496,37 +2430,38 @@ so. — *end note*]
|
|
| 2496 |
dateorder do_date_order() const;
|
| 2497 |
```
|
| 2498 |
|
| 2499 |
*Returns:* An enumeration value indicating the preferred order of
|
| 2500 |
components for those date formats that are composed of day, month, and
|
| 2501 |
-
year.[^16]
|
| 2502 |
-
|
| 2503 |
-
|
|
|
|
| 2504 |
|
| 2505 |
``` cpp
|
| 2506 |
iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
|
| 2507 |
ios_base::iostate& err, tm* t) const;
|
| 2508 |
```
|
| 2509 |
|
| 2510 |
*Effects:* Reads characters starting at `s` until it has extracted those
|
| 2511 |
-
`
|
| 2512 |
-
|
| 2513 |
-
|
| 2514 |
|
| 2515 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2516 |
recognized as possibly part of a valid time.
|
| 2517 |
|
| 2518 |
``` cpp
|
| 2519 |
iter_type do_get_date(iter_type s, iter_type end, ios_base& str,
|
| 2520 |
ios_base::iostate& err, tm* t) const;
|
| 2521 |
```
|
| 2522 |
|
| 2523 |
*Effects:* Reads characters starting at `s` until it has extracted those
|
| 2524 |
-
`
|
| 2525 |
-
|
| 2526 |
-
|
| 2527 |
-
|
| 2528 |
|
| 2529 |
**Table: `do_get_date` effects** <a id="locale.time.get.dogetdate">[locale.time.get.dogetdate]</a>
|
| 2530 |
|
| 2531 |
| `date_order()` | Format |
|
| 2532 |
| -------------- | ---------- |
|
|
@@ -2550,13 +2485,13 @@ iter_type do_get_monthname(iter_type s, iter_type end, ios_base& str,
|
|
| 2550 |
ios_base::iostate& err, tm* t) const;
|
| 2551 |
```
|
| 2552 |
|
| 2553 |
*Effects:* Reads characters starting at `s` until it has extracted the
|
| 2554 |
(perhaps abbreviated) name of a weekday or month. If it finds an
|
| 2555 |
-
abbreviation that is followed by characters that
|
| 2556 |
-
|
| 2557 |
-
|
| 2558 |
|
| 2559 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2560 |
recognized as part of a valid name.
|
| 2561 |
|
| 2562 |
``` cpp
|
|
@@ -2579,36 +2514,36 @@ iter_type do_get(iter_type s, iter_type end, ios_base& f,
|
|
| 2579 |
|
| 2580 |
*Preconditions:* `t` points to an object.
|
| 2581 |
|
| 2582 |
*Effects:* The function starts by evaluating `err = ios_base::goodbit`.
|
| 2583 |
It then reads characters starting at `s` until it encounters an error,
|
| 2584 |
-
or until it has extracted and assigned those `
|
| 2585 |
-
|
| 2586 |
-
appropriate for the
|
| 2587 |
-
|
| 2588 |
-
|
| 2589 |
-
|
| 2590 |
-
|
| 2591 |
-
|
| 2592 |
`err |= ios_base::eofbit`.
|
| 2593 |
|
| 2594 |
-
For complex conversion
|
| 2595 |
-
|
| 2596 |
-
function is unable to unambiguously determine some or all
|
| 2597 |
-
members from the input sequence \[`s`, `end`), it evaluates
|
| 2598 |
-
`err |= ios_base::eofbit`. In such cases the values of those `
|
| 2599 |
members are unspecified and may be outside their valid range.
|
| 2600 |
|
| 2601 |
-
*Remarks:* It is unspecified whether multiple calls to `do_get()` with
|
| 2602 |
-
the address of the same `struct tm` object will update the current
|
| 2603 |
-
contents of the object or simply overwrite its members. Portable
|
| 2604 |
-
programs should zero out the object before invoking the function.
|
| 2605 |
-
|
| 2606 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2607 |
recognized as possibly part of a valid input sequence for the given
|
| 2608 |
`format` and `modifier`.
|
| 2609 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2610 |
#### Class template `time_get_byname` <a id="locale.time.get.byname">[[locale.time.get.byname]]</a>
|
| 2611 |
|
| 2612 |
``` cpp
|
| 2613 |
namespace std {
|
| 2614 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
|
@@ -2671,18 +2606,20 @@ call to `do_put`; thus, format elements and other characters are
|
|
| 2671 |
interleaved in the output in the order in which they appear in the
|
| 2672 |
pattern. Format sequences are identified by converting each character
|
| 2673 |
`c` to a `char` value as if by `ct.narrow(c, 0)`, where `ct` is a
|
| 2674 |
reference to `ctype<charT>` obtained from `str.getloc()`. The first
|
| 2675 |
character of each sequence is equal to `’%’`, followed by an optional
|
| 2676 |
-
modifier character `mod`[^17]
|
| 2677 |
-
|
| 2678 |
-
|
|
|
|
|
|
|
| 2679 |
`do_put(s, str, fill, t, spec, mod)`.
|
| 2680 |
|
| 2681 |
The second form calls `do_put(s, str, fill, t, format, modifier)`.
|
| 2682 |
|
| 2683 |
-
[*Note 1*: The `fill` argument
|
| 2684 |
implementation-defined formats or by derivations. A space character is a
|
| 2685 |
reasonable default for this argument. — *end note*]
|
| 2686 |
|
| 2687 |
*Returns:* An iterator pointing immediately after the last character
|
| 2688 |
produced.
|
|
@@ -2696,21 +2633,29 @@ iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
|
|
| 2696 |
|
| 2697 |
*Effects:* Formats the contents of the parameter `t` into characters
|
| 2698 |
placed on the output sequence `s`. Formatting is controlled by the
|
| 2699 |
parameters `format` and `modifier`, interpreted identically as the
|
| 2700 |
format specifiers in the string argument to the standard library
|
| 2701 |
-
function `strftime()`
|
| 2702 |
-
|
| 2703 |
-
|
|
|
|
|
|
|
|
|
|
| 2704 |
|
| 2705 |
*Returns:* An iterator pointing immediately after the last character
|
| 2706 |
produced.
|
| 2707 |
|
| 2708 |
-
[*Note
|
| 2709 |
implementation-defined formats or by derivations. A space character is a
|
| 2710 |
reasonable default for this argument. — *end note*]
|
| 2711 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2712 |
#### Class template `time_put_byname` <a id="locale.time.put.byname">[[locale.time.put.byname]]</a>
|
| 2713 |
|
| 2714 |
``` cpp
|
| 2715 |
namespace std {
|
| 2716 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
|
@@ -2728,10 +2673,12 @@ namespace std {
|
|
| 2728 |
}
|
| 2729 |
```
|
| 2730 |
|
| 2731 |
### The monetary category <a id="category.monetary">[[category.monetary]]</a>
|
| 2732 |
|
|
|
|
|
|
|
| 2733 |
These templates handle monetary formats. A template parameter indicates
|
| 2734 |
whether local or international monetary formats are to be used.
|
| 2735 |
|
| 2736 |
All specifications of member functions for `money_put` and `money_get`
|
| 2737 |
in the subclauses of [[category.monetary]] only apply to the
|
|
@@ -2848,11 +2795,11 @@ the result is given a positive sign.
|
|
| 2848 |
|
| 2849 |
Digits in the numeric monetary component are extracted and placed in
|
| 2850 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 2851 |
value for `units`, in the order in which they appear, preceded by a
|
| 2852 |
minus sign if and only if the result is negative. The value `units` is
|
| 2853 |
-
produced as if by[^
|
| 2854 |
|
| 2855 |
``` cpp
|
| 2856 |
for (int i = 0; i < n; ++i)
|
| 2857 |
buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
|
| 2858 |
buf2[n] = 0;
|
|
@@ -2939,10 +2886,13 @@ minus sign) in `digits` or `buf2`. In `digits`, only the optional
|
|
| 2939 |
leading minus sign and the immediately subsequent digit characters (as
|
| 2940 |
classified according to `ct`) are used; any trailing characters
|
| 2941 |
(including digits appearing after a non-digit character) are ignored.
|
| 2942 |
Calls `str.width(0)`.
|
| 2943 |
|
|
|
|
|
|
|
|
|
|
| 2944 |
*Remarks:* The currency symbol is generated if and only if
|
| 2945 |
`(str.flags() & str.showbase)` is nonzero. If the number of characters
|
| 2946 |
generated for the specified format is less than the value returned by
|
| 2947 |
`str.width()` on entry to the function, then copies of `fill` are
|
| 2948 |
inserted as necessary to pad to the specified width. For the value `af`
|
|
@@ -2954,15 +2904,14 @@ before the other characters.
|
|
| 2954 |
|
| 2955 |
[*Note 1*: It is possible, with some combinations of format patterns
|
| 2956 |
and flag values, to produce output that cannot be parsed using
|
| 2957 |
`num_get<>::get`. — *end note*]
|
| 2958 |
|
| 2959 |
-
*Returns:* An iterator pointing immediately after the last character
|
| 2960 |
-
produced.
|
| 2961 |
-
|
| 2962 |
#### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
|
| 2963 |
|
|
|
|
|
|
|
| 2964 |
``` cpp
|
| 2965 |
namespace std {
|
| 2966 |
class money_base {
|
| 2967 |
public:
|
| 2968 |
enum part { none, space, symbol, sign, value };
|
|
@@ -3007,14 +2956,16 @@ namespace std {
|
|
| 3007 |
|
| 3008 |
The `moneypunct<>` facet defines monetary formatting parameters used by
|
| 3009 |
`money_get<>` and `money_put<>`. A monetary format is a sequence of four
|
| 3010 |
components, specified by a `pattern` value `p`, such that the `part`
|
| 3011 |
value `static_cast<part>(p.field[i])` determines the `i`ᵗʰ component of
|
| 3012 |
-
the format[^
|
| 3013 |
-
|
| 3014 |
-
|
| 3015 |
-
|
|
|
|
|
|
|
| 3016 |
|
| 3017 |
Where `none` or `space` appears, whitespace is permitted in the format,
|
| 3018 |
except where `none` appears at the end, in which case no whitespace is
|
| 3019 |
permitted. The value `space` indicates that at least one space is
|
| 3020 |
required at that position. Where `symbol` appears, the sequence of
|
|
@@ -3096,25 +3047,25 @@ corresponding virtual member function `do_F()`.
|
|
| 3096 |
``` cpp
|
| 3097 |
charT do_decimal_point() const;
|
| 3098 |
```
|
| 3099 |
|
| 3100 |
*Returns:* The radix separator to use in case `do_frac_digits()` is
|
| 3101 |
-
greater than zero.[^
|
| 3102 |
|
| 3103 |
``` cpp
|
| 3104 |
charT do_thousands_sep() const;
|
| 3105 |
```
|
| 3106 |
|
| 3107 |
*Returns:* The digit group separator to use in case `do_grouping()`
|
| 3108 |
-
specifies a digit grouping pattern.[^
|
| 3109 |
|
| 3110 |
``` cpp
|
| 3111 |
string do_grouping() const;
|
| 3112 |
```
|
| 3113 |
|
| 3114 |
*Returns:* A pattern defined identically as, but not necessarily equal
|
| 3115 |
-
to, the result of `numpunct<charT>::do_grouping()`.[^
|
| 3116 |
|
| 3117 |
``` cpp
|
| 3118 |
string_type do_curr_symbol() const;
|
| 3119 |
```
|
| 3120 |
|
|
@@ -3128,19 +3079,21 @@ specified by ISO 4217 followed by a space. — *end note*]
|
|
| 3128 |
string_type do_positive_sign() const;
|
| 3129 |
string_type do_negative_sign() const;
|
| 3130 |
```
|
| 3131 |
|
| 3132 |
*Returns:* `do_positive_sign()` returns the string to use to indicate a
|
| 3133 |
-
positive monetary value;[^
|
| 3134 |
-
|
|
|
|
|
|
|
| 3135 |
|
| 3136 |
``` cpp
|
| 3137 |
int do_frac_digits() const;
|
| 3138 |
```
|
| 3139 |
|
| 3140 |
*Returns:* The number of digits after the decimal radix separator, if
|
| 3141 |
-
any.[^
|
| 3142 |
|
| 3143 |
``` cpp
|
| 3144 |
pattern do_pos_format() const;
|
| 3145 |
pattern do_neg_format() const;
|
| 3146 |
```
|
|
@@ -3152,11 +3105,11 @@ pattern do_neg_format() const;
|
|
| 3152 |
- `moneypunct<wchar_t>`,
|
| 3153 |
- `moneypunct<char, true>`, and
|
| 3154 |
- `moneypunct<wchar_t, true>`,
|
| 3155 |
|
| 3156 |
return an object of type `pattern` initialized to
|
| 3157 |
-
`{ symbol, sign, none, value }`.[^
|
| 3158 |
|
| 3159 |
#### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
|
| 3160 |
|
| 3161 |
``` cpp
|
| 3162 |
namespace std {
|
|
@@ -3175,15 +3128,19 @@ namespace std {
|
|
| 3175 |
}
|
| 3176 |
```
|
| 3177 |
|
| 3178 |
### The message retrieval category <a id="category.messages">[[category.messages]]</a>
|
| 3179 |
|
|
|
|
|
|
|
| 3180 |
Class `messages<charT>` implements retrieval of strings from message
|
| 3181 |
catalogs.
|
| 3182 |
|
| 3183 |
#### Class template `messages` <a id="locale.messages">[[locale.messages]]</a>
|
| 3184 |
|
|
|
|
|
|
|
| 3185 |
``` cpp
|
| 3186 |
namespace std {
|
| 3187 |
class messages_base {
|
| 3188 |
public:
|
| 3189 |
using catalog = unspecified signed integer type;
|
|
@@ -3317,10 +3274,12 @@ namespace std {
|
|
| 3317 |
```
|
| 3318 |
|
| 3319 |
The contents and meaning of the header `<clocale>` are the same as the C
|
| 3320 |
standard library header `<locale.h>`.
|
| 3321 |
|
|
|
|
|
|
|
| 3322 |
Calls to the function `setlocale` may introduce a data race
|
| 3323 |
[[res.on.data.races]] with other calls to `setlocale` or with calls to
|
| 3324 |
the functions listed in [[setlocale.data.races]].
|
| 3325 |
|
| 3326 |
See also: ISO C 7.11
|
|
@@ -3349,23 +3308,29 @@ See also: ISO C 7.11
|
|
| 3349 |
[bitmask.types]: library.md#bitmask.types
|
| 3350 |
[c.files]: input.md#c.files
|
| 3351 |
[c.locales]: #c.locales
|
| 3352 |
[category.collate]: #category.collate
|
| 3353 |
[category.ctype]: #category.ctype
|
|
|
|
| 3354 |
[category.messages]: #category.messages
|
|
|
|
| 3355 |
[category.monetary]: #category.monetary
|
|
|
|
| 3356 |
[category.numeric]: #category.numeric
|
|
|
|
| 3357 |
[category.time]: #category.time
|
|
|
|
| 3358 |
[classification]: #classification
|
|
|
|
| 3359 |
[clocale.syn]: #clocale.syn
|
| 3360 |
-
[conversions]: #conversions
|
| 3361 |
[conversions.character]: #conversions.character
|
| 3362 |
[facet.ctype.char.dtor]: #facet.ctype.char.dtor
|
| 3363 |
[facet.ctype.char.members]: #facet.ctype.char.members
|
| 3364 |
[facet.ctype.char.statics]: #facet.ctype.char.statics
|
| 3365 |
[facet.ctype.char.virtuals]: #facet.ctype.char.virtuals
|
| 3366 |
[facet.ctype.special]: #facet.ctype.special
|
|
|
|
| 3367 |
[facet.num.get.members]: #facet.num.get.members
|
| 3368 |
[facet.num.get.virtuals]: #facet.num.get.virtuals
|
| 3369 |
[facet.num.put.members]: #facet.num.put.members
|
| 3370 |
[facet.num.put.virtuals]: #facet.num.put.virtuals
|
| 3371 |
[facet.numpunct]: #facet.numpunct
|
|
@@ -3377,57 +3342,68 @@ See also: ISO C 7.11
|
|
| 3377 |
[istream.formatted.reqmts]: input.md#istream.formatted.reqmts
|
| 3378 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 3379 |
[lex.charset]: lex.md#lex.charset
|
| 3380 |
[locale]: #locale
|
| 3381 |
[locale.categories]: #locale.categories
|
|
|
|
| 3382 |
[locale.category]: #locale.category
|
| 3383 |
[locale.category.facets]: #locale.category.facets
|
| 3384 |
[locale.codecvt]: #locale.codecvt
|
| 3385 |
[locale.codecvt.byname]: #locale.codecvt.byname
|
|
|
|
| 3386 |
[locale.codecvt.inout]: #locale.codecvt.inout
|
| 3387 |
[locale.codecvt.members]: #locale.codecvt.members
|
| 3388 |
[locale.codecvt.unshift]: #locale.codecvt.unshift
|
| 3389 |
[locale.codecvt.virtuals]: #locale.codecvt.virtuals
|
| 3390 |
[locale.collate]: #locale.collate
|
| 3391 |
[locale.collate.byname]: #locale.collate.byname
|
|
|
|
| 3392 |
[locale.collate.members]: #locale.collate.members
|
| 3393 |
[locale.collate.virtuals]: #locale.collate.virtuals
|
| 3394 |
[locale.cons]: #locale.cons
|
| 3395 |
[locale.convenience]: #locale.convenience
|
| 3396 |
[locale.ctype]: #locale.ctype
|
| 3397 |
[locale.ctype.byname]: #locale.ctype.byname
|
|
|
|
| 3398 |
[locale.ctype.members]: #locale.ctype.members
|
| 3399 |
[locale.ctype.virtuals]: #locale.ctype.virtuals
|
| 3400 |
[locale.facet]: #locale.facet
|
|
|
|
| 3401 |
[locale.global.templates]: #locale.global.templates
|
| 3402 |
[locale.id]: #locale.id
|
| 3403 |
[locale.members]: #locale.members
|
| 3404 |
[locale.messages]: #locale.messages
|
| 3405 |
[locale.messages.byname]: #locale.messages.byname
|
|
|
|
| 3406 |
[locale.messages.members]: #locale.messages.members
|
| 3407 |
[locale.messages.virtuals]: #locale.messages.virtuals
|
| 3408 |
[locale.money.get]: #locale.money.get
|
| 3409 |
[locale.money.get.members]: #locale.money.get.members
|
| 3410 |
[locale.money.get.virtuals]: #locale.money.get.virtuals
|
| 3411 |
[locale.money.put]: #locale.money.put
|
| 3412 |
[locale.money.put.members]: #locale.money.put.members
|
| 3413 |
[locale.money.put.virtuals]: #locale.money.put.virtuals
|
| 3414 |
[locale.moneypunct]: #locale.moneypunct
|
| 3415 |
[locale.moneypunct.byname]: #locale.moneypunct.byname
|
|
|
|
| 3416 |
[locale.moneypunct.members]: #locale.moneypunct.members
|
| 3417 |
[locale.moneypunct.virtuals]: #locale.moneypunct.virtuals
|
| 3418 |
[locale.nm.put]: #locale.nm.put
|
|
|
|
| 3419 |
[locale.num.get]: #locale.num.get
|
|
|
|
| 3420 |
[locale.numpunct]: #locale.numpunct
|
| 3421 |
[locale.numpunct.byname]: #locale.numpunct.byname
|
|
|
|
| 3422 |
[locale.operators]: #locale.operators
|
| 3423 |
[locale.spec]: #locale.spec
|
| 3424 |
[locale.statics]: #locale.statics
|
| 3425 |
[locale.syn]: #locale.syn
|
| 3426 |
[locale.time.get]: #locale.time.get
|
| 3427 |
[locale.time.get.byname]: #locale.time.get.byname
|
| 3428 |
[locale.time.get.dogetdate]: #locale.time.get.dogetdate
|
|
|
|
| 3429 |
[locale.time.get.members]: #locale.time.get.members
|
| 3430 |
[locale.time.get.virtuals]: #locale.time.get.virtuals
|
| 3431 |
[locale.time.put]: #locale.time.put
|
| 3432 |
[locale.time.put.byname]: #locale.time.put.byname
|
| 3433 |
[locale.time.put.members]: #locale.time.put.members
|
|
@@ -3443,12 +3419,12 @@ See also: ISO C 7.11
|
|
| 3443 |
[setlocale.data.races]: #setlocale.data.races
|
| 3444 |
[tab:locale.category.facets]: #tab:locale.category.facets
|
| 3445 |
[tab:locale.spec]: #tab:locale.spec
|
| 3446 |
[vector]: containers.md#vector
|
| 3447 |
|
| 3448 |
-
[^1]: In this subclause, the type name `
|
| 3449 |
-
|
| 3450 |
|
| 3451 |
[^2]: Note that in the call to `put`, the stream is implicitly converted
|
| 3452 |
to an `ostreambuf_iterator<charT, traits>`.
|
| 3453 |
|
| 3454 |
[^3]: This is a complete list of requirements; there are no other
|
|
@@ -3456,11 +3432,11 @@ See also: ISO C 7.11
|
|
| 3456 |
constructor, assignment, default constructor, destructor, etc.
|
| 3457 |
|
| 3458 |
[^4]: When used in a loop, it is faster to cache the `ctype<>` facet and
|
| 3459 |
use it directly, or use the vector form of `ctype<>::is`.
|
| 3460 |
|
| 3461 |
-
[^5]: The
|
| 3462 |
derived from *character-literal*s for conversion to the locale’s
|
| 3463 |
encoding.
|
| 3464 |
|
| 3465 |
[^6]: In other words, the transformed character is not a member of any
|
| 3466 |
character classification that `c` is not also a member of.
|
|
@@ -3469,20 +3445,20 @@ See also: ISO C 7.11
|
|
| 3469 |
provided. The specialization is specified in the standard, and not
|
| 3470 |
left as an implementation detail, because it affects the derivation
|
| 3471 |
interface for `ctype<char>`.
|
| 3472 |
|
| 3473 |
[^8]: Informally, this means that `basic_filebuf` assumes that the
|
| 3474 |
-
mappings from internal to external characters is 1 to N:
|
| 3475 |
-
facet that is used by `basic_filebuf`
|
| 3476 |
characters one internal character at a time.
|
| 3477 |
|
| 3478 |
[^9]: Typically these will be characters to return the state to
|
| 3479 |
`stateT()`.
|
| 3480 |
|
| 3481 |
[^10]: If `encoding()` yields `-1`, then more than `max_length()`
|
| 3482 |
-
`externT` elements
|
| 3483 |
-
character, and additional `externT` elements
|
| 3484 |
of a sequence after those that yield the final `internT` character.
|
| 3485 |
|
| 3486 |
[^11]: Parsing `"-1"` correctly into, e.g., an `unsigned short` requires
|
| 3487 |
that the corresponding member `get()` at least extract the sign
|
| 3488 |
before delegating.
|
|
@@ -3501,33 +3477,27 @@ See also: ISO C 7.11
|
|
| 3501 |
parsing of user-entered dates and times, but machine-generated
|
| 3502 |
formats can be parsed reliably. This allows parsers to be aggressive
|
| 3503 |
about interpreting user variations on standard formats.
|
| 3504 |
|
| 3505 |
[^16]: This function is intended as a convenience only, for common
|
| 3506 |
-
formats, and
|
| 3507 |
|
| 3508 |
[^17]: Although the C programming language defines no modifiers, most
|
| 3509 |
vendors do.
|
| 3510 |
|
| 3511 |
-
[^18]:
|
| 3512 |
-
implementation-defined, but should follow POSIX conventions.
|
| 3513 |
|
| 3514 |
-
[^19]:
|
| 3515 |
-
these definitions.
|
| 3516 |
-
|
| 3517 |
-
[^20]: The semantics here are different from `ct.narrow`.
|
| 3518 |
-
|
| 3519 |
-
[^21]: An array of `char`, rather than an array of `part`, is specified
|
| 3520 |
for `pattern::field` purely for efficiency.
|
| 3521 |
|
| 3522 |
-
[^
|
| 3523 |
|
| 3524 |
-
[^
|
| 3525 |
|
| 3526 |
-
[^
|
| 3527 |
|
| 3528 |
-
[^
|
| 3529 |
|
| 3530 |
-
[^
|
| 3531 |
|
| 3532 |
-
[^
|
| 3533 |
usually contains a space, itself; for example, `"USD "`.
|
|
|
|
| 103 |
|
| 104 |
## Locales <a id="locales">[[locales]]</a>
|
| 105 |
|
| 106 |
### Class `locale` <a id="locale">[[locale]]</a>
|
| 107 |
|
| 108 |
+
#### General <a id="locale.general">[[locale.general]]</a>
|
| 109 |
+
|
| 110 |
``` cpp
|
| 111 |
namespace std {
|
| 112 |
class locale {
|
| 113 |
public:
|
| 114 |
// types
|
|
|
|
| 159 |
Access to the facets of a `locale` is via two function templates,
|
| 160 |
`use_facet<>` and `has_facet<>`.
|
| 161 |
|
| 162 |
[*Example 1*:
|
| 163 |
|
| 164 |
+
An iostream `operator<<` can be implemented as:[^2]
|
| 165 |
|
| 166 |
``` cpp
|
| 167 |
template<class charT, class traits>
|
| 168 |
basic_ostream<charT, traits>&
|
| 169 |
operator<< (basic_ostream<charT, traits>& s, Date d) {
|
|
|
|
| 172 |
tm tmbuf; d.extract(tmbuf);
|
| 173 |
bool failed =
|
| 174 |
use_facet<time_put<charT, ostreambuf_iterator<charT, traits>>>(
|
| 175 |
s.getloc()).put(s, s, s.fill(), &tmbuf, 'x').failed();
|
| 176 |
if (failed)
|
| 177 |
+
s.setstate(s.badbit); // can throw
|
| 178 |
}
|
| 179 |
return s;
|
| 180 |
}
|
| 181 |
```
|
| 182 |
|
|
|
|
| 193 |
|
| 194 |
All locale semantics are accessed via `use_facet<>` and `has_facet<>`,
|
| 195 |
except that:
|
| 196 |
|
| 197 |
- A member operator template
|
| 198 |
+
``` cpp
|
| 199 |
+
operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
is provided so that a locale can be used as a predicate argument to
|
| 203 |
the standard collections, to collate strings.
|
| 204 |
- Convenient global interfaces are provided for traditional `ctype`
|
| 205 |
functions such as `isdigit()` and `isspace()`, so that given a locale
|
| 206 |
object `loc` a C++ program can call `isspace(c, loc)`. (This eases
|
| 207 |
upgrading existing extractors [[istream.formatted]].)
|
|
|
|
| 250 |
|
| 251 |
is `true`, and represents the union of all categories. Further, the
|
| 252 |
expression `(X | Y)`, where `X` and `Y` each represent a single
|
| 253 |
category, represents the union of the two categories.
|
| 254 |
|
| 255 |
+
`locale` member functions expecting a `category` argument require one of
|
| 256 |
+
the `category` values defined above, or the union of two or more such
|
|
|
|
|
|
|
| 257 |
values. Such a `category` value identifies a set of locale categories.
|
| 258 |
Each locale category, in turn, identifies a set of locale facets,
|
| 259 |
including at least those shown in [[locale.category.facets]].
|
| 260 |
|
| 261 |
**Table: Locale category facets** <a id="locale.category.facets">[locale.category.facets]</a>
|
|
|
|
| 372 |
for `refs == 1`, the implementation never destroys the facet.
|
| 373 |
|
| 374 |
Constructors of all facets defined in this Clause take such an argument
|
| 375 |
and pass it along to their `facet` base class constructor. All
|
| 376 |
one-argument constructors defined in this Clause are *explicit*,
|
| 377 |
+
preventing their participation in implicit conversions.
|
| 378 |
|
| 379 |
For some standard facets a standard “…`_byname`” class, derived from it,
|
| 380 |
implements the virtual function semantics equivalent to that facet of
|
| 381 |
the locale constructed by `locale(const char*)` with the same name. Each
|
| 382 |
such facet provides a constructor that takes a `const char*` argument,
|
|
|
|
| 443 |
|
| 444 |
``` cpp
|
| 445 |
explicit locale(const string& std_name);
|
| 446 |
```
|
| 447 |
|
| 448 |
+
*Effects:* Equivalent to `locale(std_name.c_str())`.
|
| 449 |
|
| 450 |
``` cpp
|
| 451 |
+
locale(const locale& other, const char* std_name, category cats);
|
| 452 |
```
|
| 453 |
|
| 454 |
+
*Preconditions:* `cats` is a valid `category` value [[locale.category]].
|
| 455 |
+
|
| 456 |
*Effects:* Constructs a locale as a copy of `other` except for the
|
| 457 |
facets identified by the `category` argument, which instead implement
|
| 458 |
the same semantics as `locale(std_name)`.
|
| 459 |
|
| 460 |
+
*Throws:* `runtime_error` if the second argument is not valid, or is
|
| 461 |
+
null.
|
| 462 |
|
| 463 |
*Remarks:* The locale has a name if and only if `other` has a name.
|
| 464 |
|
| 465 |
``` cpp
|
| 466 |
+
locale(const locale& other, const string& std_name, category cats);
|
| 467 |
```
|
| 468 |
|
| 469 |
+
*Effects:* Equivalent to `locale(other, std_name.c_str(), cats)`.
|
| 470 |
|
| 471 |
``` cpp
|
| 472 |
template<class Facet> locale(const locale& other, Facet* f);
|
| 473 |
```
|
| 474 |
|
| 475 |
*Effects:* Constructs a locale incorporating all facets from the first
|
| 476 |
argument except that of type `Facet`, and installs the second argument
|
| 477 |
as the remaining facet. If `f` is null, the resulting object is a copy
|
| 478 |
of `other`.
|
| 479 |
|
| 480 |
+
*Remarks:* If `f` is null, the resulting locale has the same name as
|
| 481 |
+
`other`. Otherwise, the resulting locale has no name.
|
| 482 |
|
| 483 |
``` cpp
|
| 484 |
locale(const locale& other, const locale& one, category cats);
|
| 485 |
```
|
| 486 |
|
| 487 |
+
*Preconditions:* `cats` is a valid `category` value.
|
| 488 |
+
|
| 489 |
*Effects:* Constructs a locale incorporating all facets from the first
|
| 490 |
argument except those that implement `cats`, which are instead
|
| 491 |
incorporated from the second argument.
|
| 492 |
|
| 493 |
+
*Remarks:* If `cats` is equal to `locale::none`, the resulting locale
|
| 494 |
+
has a name if and only if the first argument has a name. Otherwise, the
|
| 495 |
+
resulting locale has a name if and only if the first two arguments both
|
| 496 |
+
have names.
|
| 497 |
|
| 498 |
``` cpp
|
| 499 |
const locale& operator=(const locale& other) noexcept;
|
| 500 |
```
|
| 501 |
|
|
|
|
| 541 |
const basic_string<charT, traits, Allocator>& s2) const;
|
| 542 |
```
|
| 543 |
|
| 544 |
*Effects:* Compares two strings according to the `collate<charT>` facet.
|
| 545 |
|
| 546 |
+
*Returns:*
|
| 547 |
+
|
| 548 |
+
``` cpp
|
| 549 |
+
use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
|
| 550 |
+
s2.data(), s2.data() + s2.size()) < 0
|
| 551 |
+
```
|
| 552 |
+
|
| 553 |
*Remarks:* This member operator template (and therefore `locale` itself)
|
| 554 |
meets the requirements for a comparator predicate template
|
| 555 |
argument [[algorithms]] applied to strings.
|
| 556 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 557 |
[*Example 1*:
|
| 558 |
|
| 559 |
A vector of strings `v` can be collated according to collation rules in
|
| 560 |
+
locale `loc` simply by [[alg.sort]], [[vector]]:
|
| 561 |
|
| 562 |
``` cpp
|
| 563 |
std::sort(v.begin(), v.end(), loc);
|
| 564 |
```
|
| 565 |
|
|
|
|
| 580 |
```
|
| 581 |
|
| 582 |
otherwise, the effect on the C locale, if any, is
|
| 583 |
*implementation-defined*.
|
| 584 |
|
| 585 |
+
*Returns:* The previous value of `locale()`.
|
| 586 |
+
|
| 587 |
*Remarks:* No library function other than `locale::global()` affects the
|
| 588 |
value returned by `locale()`.
|
| 589 |
|
| 590 |
[*Note 1*: See [[c.locales]] for data race considerations when
|
| 591 |
`setlocale` is invoked. — *end note*]
|
| 592 |
|
|
|
|
|
|
|
| 593 |
``` cpp
|
| 594 |
static const locale& classic();
|
| 595 |
```
|
| 596 |
|
| 597 |
The `"C"` locale.
|
|
|
|
| 651 |
```
|
| 652 |
|
| 653 |
where `F` is the `ctype_base::mask` value corresponding to that function
|
| 654 |
[[category.ctype]].[^4]
|
| 655 |
|
| 656 |
+
#### Character conversions <a id="conversions.character">[[conversions.character]]</a>
|
|
|
|
|
|
|
| 657 |
|
| 658 |
``` cpp
|
| 659 |
template<class charT> charT toupper(charT c, const locale& loc);
|
| 660 |
```
|
| 661 |
|
|
|
|
| 667 |
|
| 668 |
*Returns:* `use_facet<ctype<charT>>(loc).tolower(c)`.
|
| 669 |
|
| 670 |
## Standard `locale` categories <a id="locale.categories">[[locale.categories]]</a>
|
| 671 |
|
| 672 |
+
### General <a id="locale.categories.general">[[locale.categories.general]]</a>
|
| 673 |
+
|
| 674 |
Each of the standard categories includes a family of facets. Some of
|
| 675 |
these implement formatting or parsing of a datum, for use by standard or
|
| 676 |
users’ iostream operators `<<` and `>>`, as members `put()` and `get()`,
|
| 677 |
respectively. Each such member function takes an `ios_base&` argument
|
| 678 |
whose members `flags()`, `precision()`, and `width()`, specify the
|
|
|
|
| 685 |
of the OutputIterator argument can be extracted from the returned
|
| 686 |
iterator.) The `get()` members take an `ios_base::iostate&` argument
|
| 687 |
whose value they ignore, but set to `ios_base::failbit` in case of a
|
| 688 |
parse error.
|
| 689 |
|
| 690 |
+
Within subclause [[locale.categories]] it is unspecified whether one
|
| 691 |
+
virtual function calls another virtual function.
|
| 692 |
|
| 693 |
### The `ctype` category <a id="category.ctype">[[category.ctype]]</a>
|
| 694 |
|
| 695 |
+
#### General <a id="category.ctype.general">[[category.ctype.general]]</a>
|
| 696 |
+
|
| 697 |
``` cpp
|
| 698 |
namespace std {
|
| 699 |
class ctype_base {
|
| 700 |
public:
|
| 701 |
using mask = see below;
|
|
|
|
| 719 |
|
| 720 |
The type `mask` is a bitmask type [[bitmask.types]].
|
| 721 |
|
| 722 |
#### Class template `ctype` <a id="locale.ctype">[[locale.ctype]]</a>
|
| 723 |
|
| 724 |
+
##### General <a id="locale.ctype.general">[[locale.ctype.general]]</a>
|
| 725 |
+
|
| 726 |
``` cpp
|
| 727 |
namespace std {
|
| 728 |
template<class charT>
|
| 729 |
class ctype : public locale::facet, public ctype_base {
|
| 730 |
public:
|
|
|
|
| 894 |
const char* do_widen(const char* low, const char* high, charT* dest) const;
|
| 895 |
```
|
| 896 |
|
| 897 |
*Effects:* Applies the simplest reasonable transformation from a `char`
|
| 898 |
value or sequence of `char` values to the corresponding `charT` value or
|
| 899 |
+
values.[^5]
|
| 900 |
+
|
| 901 |
+
The only characters for which unique transformations are required are
|
| 902 |
+
those in the basic character set [[lex.charset]].
|
| 903 |
|
| 904 |
For any named `ctype` category with a `ctype<charT>` facet `ctc` and
|
| 905 |
valid `ctype_base::mask` value `M`,
|
| 906 |
`(ctc.is(M, c) || !is(M, do_widen(c)) )` is `true`.[^6]
|
| 907 |
|
|
|
|
| 918 |
|
| 919 |
*Effects:* Applies the simplest reasonable transformation from a `charT`
|
| 920 |
value or sequence of `charT` values to the corresponding `char` value or
|
| 921 |
values.
|
| 922 |
|
| 923 |
+
For any character `c` in the basic character set [[lex.charset]] the
|
| 924 |
+
transformation is such that
|
| 925 |
|
| 926 |
``` cpp
|
| 927 |
do_widen(do_narrow(c, 0)) == c
|
| 928 |
```
|
| 929 |
|
|
|
|
| 961 |
}
|
| 962 |
```
|
| 963 |
|
| 964 |
#### `ctype<char>` specialization <a id="facet.ctype.special">[[facet.ctype.special]]</a>
|
| 965 |
|
| 966 |
+
##### General <a id="facet.ctype.special.general">[[facet.ctype.special.general]]</a>
|
| 967 |
+
|
| 968 |
``` cpp
|
| 969 |
namespace std {
|
| 970 |
template<>
|
| 971 |
class ctype<char> : public locale::facet, public ctype_base {
|
| 972 |
public:
|
|
|
|
| 1010 |
};
|
| 1011 |
}
|
| 1012 |
```
|
| 1013 |
|
| 1014 |
A specialization `ctype<char>` is provided so that the member functions
|
| 1015 |
+
on type `char` can be implemented inline.[^7]
|
| 1016 |
+
|
| 1017 |
+
The *implementation-defined* value of member `table_size` is at least
|
| 1018 |
+
256.
|
| 1019 |
|
| 1020 |
##### Destructor <a id="facet.ctype.char.dtor">[[facet.ctype.char.dtor]]</a>
|
| 1021 |
|
| 1022 |
``` cpp
|
| 1023 |
~ctype();
|
|
|
|
| 1141 |
These functions are described identically as those members of the same
|
| 1142 |
name in the `ctype` class template [[locale.ctype.members]].
|
| 1143 |
|
| 1144 |
#### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
|
| 1145 |
|
| 1146 |
+
##### General <a id="locale.codecvt.general">[[locale.codecvt.general]]</a>
|
| 1147 |
+
|
| 1148 |
``` cpp
|
| 1149 |
namespace std {
|
| 1150 |
class codecvt_base {
|
| 1151 |
public:
|
| 1152 |
enum result { ok, partial, error, noconv };
|
|
|
|
| 1215 |
The specializations required in [[locale.category.facets]]
|
| 1216 |
[[locale.category]] convert the implementation-defined native character
|
| 1217 |
set. `codecvt<char, char, mbstate_t>` implements a degenerate
|
| 1218 |
conversion; it does not convert at all. The specialization
|
| 1219 |
`codecvt<char16_t, char8_t, mbstate_t>` converts between the UTF-16 and
|
| 1220 |
+
UTF-8 encoding forms, and the specialization
|
| 1221 |
+
`codecvt<char32_t, char8_t, mbstate_t>` converts between the UTF-32 and
|
| 1222 |
+
UTF-8 encoding forms. `codecvt<wchar_t, char, mbstate_t>` converts
|
| 1223 |
+
between the native character sets for ordinary and wide characters.
|
| 1224 |
+
Specializations on `mbstate_t` perform conversion between encodings
|
| 1225 |
+
known to the library implementer. Other encodings can be converted by
|
| 1226 |
+
specializing on a program-defined `stateT` type. Objects of type
|
| 1227 |
+
`stateT` can contain any state that is useful to communicate to or from
|
| 1228 |
+
the specialized `do_in` or `do_out` members.
|
| 1229 |
|
| 1230 |
##### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
|
| 1231 |
|
| 1232 |
``` cpp
|
| 1233 |
result out(
|
|
|
|
| 1340 |
|
| 1341 |
[*Note 1*: As a result of operations on `state`, it can return `ok` or
|
| 1342 |
`partial` and set `from_next == from` and
|
| 1343 |
`to_next != to`. — *end note*]
|
| 1344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1345 |
*Returns:* An enumeration value, as summarized in
|
| 1346 |
[[locale.codecvt.inout]].
|
| 1347 |
|
| 1348 |
**Table: `do_in/do_out` result values** <a id="locale.codecvt.inout">[locale.codecvt.inout]</a>
|
| 1349 |
|
| 1350 |
| Value | Meaning |
|
| 1351 |
| --------- | ------------------------------------------------------------------------------------------------ |
|
| 1352 |
| `ok` | completed the conversion |
|
| 1353 |
| `partial` | not all source characters converted |
|
| 1354 |
+
| `error` | encountered a character in {[}`from`, `from_end`{)} that cannot be converted |
|
| 1355 |
| `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
|
| 1356 |
|
| 1357 |
|
| 1358 |
A return value of `partial`, if `(from_next == from_end)`, indicates
|
| 1359 |
that either the destination sequence has not absorbed all the available
|
| 1360 |
destination elements, or that additional source elements are needed
|
| 1361 |
before another destination element can be produced.
|
| 1362 |
|
| 1363 |
+
*Remarks:* Its operations on `state` are unspecified.
|
| 1364 |
+
|
| 1365 |
+
[*Note 2*: This argument can be used, for example, to maintain shift
|
| 1366 |
+
state, to specify conversion options (such as count only), or to
|
| 1367 |
+
identify a cache of seek offsets. — *end note*]
|
| 1368 |
+
|
| 1369 |
``` cpp
|
| 1370 |
result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
|
| 1371 |
```
|
| 1372 |
|
| 1373 |
*Preconditions:* `(to <= to_end)` is well-defined and `true`; `state` is
|
| 1374 |
initialized, if at the beginning of a sequence, or else is equal to the
|
| 1375 |
result of converting the preceding characters in the sequence.
|
| 1376 |
|
| 1377 |
*Effects:* Places characters starting at `to` that should be appended to
|
| 1378 |
terminate a sequence when the current `stateT` is given by `state`.[^9]
|
| 1379 |
+
|
| 1380 |
Stores no more than `(to_end - to)` destination elements, and leaves the
|
| 1381 |
`to_next` pointer pointing one beyond the last element successfully
|
| 1382 |
stored.
|
| 1383 |
|
| 1384 |
*Returns:* An enumeration value, as summarized in
|
|
|
|
| 1454 |
}
|
| 1455 |
```
|
| 1456 |
|
| 1457 |
### The numeric category <a id="category.numeric">[[category.numeric]]</a>
|
| 1458 |
|
| 1459 |
+
#### General <a id="category.numeric.general">[[category.numeric.general]]</a>
|
| 1460 |
+
|
| 1461 |
The classes `num_get<>` and `num_put<>` handle numeric formatting and
|
| 1462 |
parsing. Virtual functions are provided for several numeric types.
|
| 1463 |
Implementations may (but are not required to) delegate extraction of
|
| 1464 |
smaller types to extractors for larger types.[^11]
|
| 1465 |
|
|
|
|
| 1474 |
`numpunct<>` facet to identify all numeric punctuation preferences, and
|
| 1475 |
also for the `ctype<>` facet to perform character classification.
|
| 1476 |
|
| 1477 |
Extractor and inserter members of the standard iostreams use `num_get<>`
|
| 1478 |
and `num_put<>` member functions for formatting and parsing numeric
|
| 1479 |
+
values [[istream.formatted.reqmts]], [[ostream.formatted.reqmts]].
|
| 1480 |
|
| 1481 |
#### Class template `num_get` <a id="locale.num.get">[[locale.num.get]]</a>
|
| 1482 |
|
| 1483 |
+
##### General <a id="locale.num.get.general">[[locale.num.get.general]]</a>
|
| 1484 |
+
|
| 1485 |
``` cpp
|
| 1486 |
namespace std {
|
| 1487 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 1488 |
class num_get : public locale::facet {
|
| 1489 |
public:
|
|
|
|
| 1614 |
determined in stage 1.
|
| 1615 |
- Stage 3: Store results
|
| 1616 |
|
| 1617 |
The details of the stages are presented below.
|
| 1618 |
|
| 1619 |
+
[*Example 1*:
|
| 1620 |
|
| 1621 |
+
Given an input sequence of `"0x1a.bp+07p"`,
|
| 1622 |
|
| 1623 |
+
- if the conversion specifier returned by Stage 1 is `%d`, `"0"` is
|
| 1624 |
+
accumulated;
|
| 1625 |
+
- if the conversion specifier returned by Stage 1 is `%i`, `"0x1a"` are
|
| 1626 |
+
accumulated;
|
| 1627 |
+
- if the conversion specifier returned by Stage 1 is `%g`,
|
| 1628 |
+
`"0x1a.bp+07"` are accumulated.
|
| 1629 |
|
| 1630 |
+
In all cases, the remainder is left in the input.
|
|
|
|
|
|
|
|
|
|
| 1631 |
|
| 1632 |
+
— *end example*]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1633 |
|
| 1634 |
Digit grouping is checked. That is, the positions of discarded
|
| 1635 |
+
separators are examined for consistency with
|
| 1636 |
`use_facet<numpunct<charT>>(loc).grouping()`. If they are not consistent
|
| 1637 |
then `ios_base::failbit` is assigned to `err`.
|
| 1638 |
|
| 1639 |
In any case, if stage 2 processing was terminated by the test for
|
| 1640 |
`in == end` then `err |= ios_base::eofbit` is performed.
|
|
|
|
| 1667 |
`str.goodbit`; or to `str.eofbit` if, when seeking another character to
|
| 1668 |
match, it is found that `(in == end)`. If `val` is not set, then `err`
|
| 1669 |
is set to `str.failbit`; or to `(str.failbit|str.eofbit)` if the reason
|
| 1670 |
for the failure was that `(in == end)`.
|
| 1671 |
|
| 1672 |
+
[*Example 2*: For targets `true`: `"a"` and `false`: `"abb"`, the input
|
| 1673 |
sequence `"a"` yields `val == true` and `err == str.eofbit`; the input
|
| 1674 |
sequence `"abc"` yields `err = str.failbit`, with `in` ending at the
|
| 1675 |
`’c’` element. For targets `true`: `"1"` and `false`: `"0"`, the input
|
| 1676 |
sequence `"1"` yields `val == true` and `err == str.goodbit`. For empty
|
| 1677 |
targets `("")`, any input sequence yields
|
|
|
|
| 1679 |
|
| 1680 |
*Returns:* `in`.
|
| 1681 |
|
| 1682 |
#### Class template `num_put` <a id="locale.nm.put">[[locale.nm.put]]</a>
|
| 1683 |
|
| 1684 |
+
##### General <a id="locale.nm.put.general">[[locale.nm.put.general]]</a>
|
| 1685 |
+
|
| 1686 |
``` cpp
|
| 1687 |
namespace std {
|
| 1688 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 1689 |
class num_put : public locale::facet {
|
| 1690 |
public:
|
|
|
|
| 1884 |
```
|
| 1885 |
|
| 1886 |
For arithmetic types, `punct.thousands_sep()` characters are inserted
|
| 1887 |
into the sequence as determined by the value returned by
|
| 1888 |
`punct.do_grouping()` using the method described
|
| 1889 |
+
in [[facet.numpunct.virtuals]].
|
| 1890 |
|
| 1891 |
+
Decimal point characters(.) are replaced by `punct.decimal_point()`.
|
| 1892 |
|
| 1893 |
- **Stage 3:**
|
| 1894 |
|
| 1895 |
A local variable is initialized as
|
| 1896 |
|
| 1897 |
``` cpp
|
| 1898 |
fmtflags adjustfield = (flags & (ios_base::adjustfield));
|
| 1899 |
```
|
| 1900 |
|
| 1901 |
+
The location of any padding[^12]
|
| 1902 |
+
|
| 1903 |
+
is determined according to [[facet.num.put.fill]].
|
| 1904 |
|
| 1905 |
**Table: Fill padding** <a id="facet.num.put.fill">[facet.num.put.fill]</a>
|
| 1906 |
|
| 1907 |
| State | Location |
|
| 1908 |
| ------------------------------------------------------------------------------ | ------------------ |
|
|
|
|
| 1947 |
|
| 1948 |
### The numeric punctuation facet <a id="facet.numpunct">[[facet.numpunct]]</a>
|
| 1949 |
|
| 1950 |
#### Class template `numpunct` <a id="locale.numpunct">[[locale.numpunct]]</a>
|
| 1951 |
|
| 1952 |
+
##### General <a id="locale.numpunct.general">[[locale.numpunct.general]]</a>
|
| 1953 |
+
|
| 1954 |
``` cpp
|
| 1955 |
namespace std {
|
| 1956 |
template<class charT>
|
| 1957 |
class numpunct : public locale::facet {
|
| 1958 |
public:
|
|
|
|
| 1978 |
virtual string_type do_falsename() const; // for bool
|
| 1979 |
};
|
| 1980 |
}
|
| 1981 |
```
|
| 1982 |
|
| 1983 |
+
`numpunct<>` specifies numeric punctuation. The specializations required
|
| 1984 |
+
in [[locale.category.facets]] [[locale.category]], namely
|
|
|
|
|
|
|
| 1985 |
`numpunct<{}wchar_t>` and `numpunct<char>`, provide classic `"C"`
|
| 1986 |
numeric formats, i.e., they contain information equivalent to that
|
| 1987 |
contained in the `"C"` locale or their wide character counterparts as if
|
| 1988 |
obtained by a call to `widen`.
|
| 1989 |
|
|
|
|
| 2088 |
``` cpp
|
| 2089 |
string do_grouping() const;
|
| 2090 |
```
|
| 2091 |
|
| 2092 |
*Returns:* A `string` `vec` used as a vector of integer values, in which
|
| 2093 |
+
each element `vec[i]` represents the number of digits[^13]
|
| 2094 |
+
|
| 2095 |
+
in the group at position `i`, starting with position 0 as the rightmost
|
| 2096 |
+
group. If `vec.size() <= i`, the number is the same as group `(i - 1)`;
|
| 2097 |
+
if `(i < 0 || vec[i] <= 0 || vec[i] == CHAR_MAX)`, the size of the digit
|
| 2098 |
group is unlimited.
|
| 2099 |
|
| 2100 |
The required specializations return the empty string, indicating no
|
| 2101 |
grouping.
|
| 2102 |
|
|
|
|
| 2133 |
|
| 2134 |
### The collate category <a id="category.collate">[[category.collate]]</a>
|
| 2135 |
|
| 2136 |
#### Class template `collate` <a id="locale.collate">[[locale.collate]]</a>
|
| 2137 |
|
| 2138 |
+
##### General <a id="locale.collate.general">[[locale.collate.general]]</a>
|
| 2139 |
+
|
| 2140 |
``` cpp
|
| 2141 |
namespace std {
|
| 2142 |
template<class charT>
|
| 2143 |
class collate : public locale::facet {
|
| 2144 |
public:
|
|
|
|
| 2168 |
(comparison) and hashing of strings. A locale member function template,
|
| 2169 |
`operator()`, uses the collate facet to allow a locale to act directly
|
| 2170 |
as the predicate argument for standard algorithms [[algorithms]] and
|
| 2171 |
containers operating on strings. The specializations required in
|
| 2172 |
[[locale.category.facets]] [[locale.category]], namely `collate<char>`
|
| 2173 |
+
and `collate<wchar_t>`, apply lexicographical ordering
|
| 2174 |
[[alg.lex.comparison]].
|
| 2175 |
|
| 2176 |
Each function compares a string of characters `*p` in the range \[`low`,
|
| 2177 |
`high`).
|
| 2178 |
|
|
|
|
| 2225 |
|
| 2226 |
*Returns:* An integer value equal to the result of calling `hash()` on
|
| 2227 |
any other string for which `do_compare()` returns 0 (equal) when passed
|
| 2228 |
the two strings.
|
| 2229 |
|
| 2230 |
+
*Recommended practice:* The probability that the result equals that for
|
| 2231 |
+
another string which does not compare equal should be very small,
|
| 2232 |
+
approaching `(1.0/numeric_limits<unsigned long>::max())`.
|
| 2233 |
|
| 2234 |
#### Class template `collate_byname` <a id="locale.collate.byname">[[locale.collate.byname]]</a>
|
| 2235 |
|
| 2236 |
``` cpp
|
| 2237 |
namespace std {
|
|
|
|
| 2249 |
}
|
| 2250 |
```
|
| 2251 |
|
| 2252 |
### The time category <a id="category.time">[[category.time]]</a>
|
| 2253 |
|
| 2254 |
+
#### General <a id="category.time.general">[[category.time.general]]</a>
|
| 2255 |
+
|
| 2256 |
Templates `time_get<charT, InputIterator>` and
|
| 2257 |
`time_put<charT, OutputIterator>` provide date and time formatting and
|
| 2258 |
parsing. All specifications of member functions for `time_put` and
|
| 2259 |
`time_get` in the subclauses of [[category.time]] only apply to the
|
| 2260 |
specializations required in Tables [[tab:locale.category.facets]] and
|
|
|
|
| 2263 |
[[locale.categories]], and the `ctype<>` facet, to determine formatting
|
| 2264 |
details.
|
| 2265 |
|
| 2266 |
#### Class template `time_get` <a id="locale.time.get">[[locale.time.get]]</a>
|
| 2267 |
|
| 2268 |
+
##### General <a id="locale.time.get.general">[[locale.time.get.general]]</a>
|
| 2269 |
+
|
| 2270 |
``` cpp
|
| 2271 |
namespace std {
|
| 2272 |
class time_base {
|
| 2273 |
public:
|
| 2274 |
enum dateorder { no_order, dmy, mdy, ymd, ydm };
|
|
|
|
| 2318 |
ios_base::iostate& err, tm* t, char format, char modifier) const;
|
| 2319 |
};
|
| 2320 |
}
|
| 2321 |
```
|
| 2322 |
|
| 2323 |
+
`time_get` is used to parse a character sequence, extracting components
|
| 2324 |
+
of a time or date into a `tm` object. Each `get` member parses a format
|
| 2325 |
+
as produced by a corresponding format specifier to `time_put<>::put`. If
|
|
|
|
|
|
|
| 2326 |
the sequence being parsed matches the correct format, the corresponding
|
| 2327 |
+
members of the `tm` argument are set to the values used to produce the
|
| 2328 |
+
sequence; otherwise either an error is reported or unspecified values
|
| 2329 |
+
are assigned.[^15]
|
| 2330 |
|
| 2331 |
If the end iterator is reached during parsing by any of the `get()`
|
| 2332 |
member functions, the member sets `ios_base::eofbit` in `err`.
|
| 2333 |
|
| 2334 |
##### Members <a id="locale.time.get.members">[[locale.time.get.members]]</a>
|
|
|
|
| 2394 |
- The expression `s == end` evaluates to `true`, in which case the
|
| 2395 |
function evaluates `err = ios_base::eofbit | ios_base::failbit`.
|
| 2396 |
- The next element of `fmt` is equal to `’%’`, optionally followed by a
|
| 2397 |
modifier character, followed by a conversion specifier character,
|
| 2398 |
`format`, together forming a conversion specification valid for the
|
| 2399 |
+
POSIX function `strptime`. If the number of elements in the range
|
| 2400 |
+
\[`fmt`, `fmtend`) is not sufficient to unambiguously determine
|
| 2401 |
whether the conversion specification is complete and valid, the
|
| 2402 |
function evaluates `err = ios_base::failbit`. Otherwise, the function
|
| 2403 |
evaluates `s = do_get(s, end, f, err, t, format, modifier)`, where the
|
| 2404 |
value of `modifier` is `’\0’` when the optional modifier is absent
|
| 2405 |
from the conversion specification. If `err == ios_base::goodbit` holds
|
|
|
|
| 2430 |
dateorder do_date_order() const;
|
| 2431 |
```
|
| 2432 |
|
| 2433 |
*Returns:* An enumeration value indicating the preferred order of
|
| 2434 |
components for those date formats that are composed of day, month, and
|
| 2435 |
+
year.[^16]
|
| 2436 |
+
|
| 2437 |
+
Returns `no_order` if the date format specified by `’x’` contains other
|
| 2438 |
+
variable components (e.g., Julian day, week number, week day).
|
| 2439 |
|
| 2440 |
``` cpp
|
| 2441 |
iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
|
| 2442 |
ios_base::iostate& err, tm* t) const;
|
| 2443 |
```
|
| 2444 |
|
| 2445 |
*Effects:* Reads characters starting at `s` until it has extracted those
|
| 2446 |
+
`tm` members, and remaining format characters, used by `time_put<>::put`
|
| 2447 |
+
to produce the format specified by `"%H:%M:%S"`, or until it encounters
|
| 2448 |
+
an error or end of sequence.
|
| 2449 |
|
| 2450 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2451 |
recognized as possibly part of a valid time.
|
| 2452 |
|
| 2453 |
``` cpp
|
| 2454 |
iter_type do_get_date(iter_type s, iter_type end, ios_base& str,
|
| 2455 |
ios_base::iostate& err, tm* t) const;
|
| 2456 |
```
|
| 2457 |
|
| 2458 |
*Effects:* Reads characters starting at `s` until it has extracted those
|
| 2459 |
+
`tm` members and remaining format characters used by `time_put<>::put`
|
| 2460 |
+
to produce one of the following formats, or until it encounters an
|
| 2461 |
+
error. The format depends on the value returned by `date_order()` as
|
| 2462 |
+
shown in [[locale.time.get.dogetdate]].
|
| 2463 |
|
| 2464 |
**Table: `do_get_date` effects** <a id="locale.time.get.dogetdate">[locale.time.get.dogetdate]</a>
|
| 2465 |
|
| 2466 |
| `date_order()` | Format |
|
| 2467 |
| -------------- | ---------- |
|
|
|
|
| 2485 |
ios_base::iostate& err, tm* t) const;
|
| 2486 |
```
|
| 2487 |
|
| 2488 |
*Effects:* Reads characters starting at `s` until it has extracted the
|
| 2489 |
(perhaps abbreviated) name of a weekday or month. If it finds an
|
| 2490 |
+
abbreviation that is followed by characters that can match a full name,
|
| 2491 |
+
it continues reading until it matches the full name or fails. It sets
|
| 2492 |
+
the appropriate `tm` member accordingly.
|
| 2493 |
|
| 2494 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2495 |
recognized as part of a valid name.
|
| 2496 |
|
| 2497 |
``` cpp
|
|
|
|
| 2514 |
|
| 2515 |
*Preconditions:* `t` points to an object.
|
| 2516 |
|
| 2517 |
*Effects:* The function starts by evaluating `err = ios_base::goodbit`.
|
| 2518 |
It then reads characters starting at `s` until it encounters an error,
|
| 2519 |
+
or until it has extracted and assigned those `tm` members, and any
|
| 2520 |
+
remaining format characters, corresponding to a conversion specification
|
| 2521 |
+
appropriate for the POSIX function `strptime`, formed by concatenating
|
| 2522 |
+
`’%’`, the `modifier` character, when non-NUL, and the `format`
|
| 2523 |
+
character. When the concatenation fails to yield a complete valid
|
| 2524 |
+
directive the function leaves the object pointed to by `t` unchanged and
|
| 2525 |
+
evaluates `err |= ios_base::failbit`. When `s == end` evaluates to
|
| 2526 |
+
`true` after reading a character the function evaluates
|
| 2527 |
`err |= ios_base::eofbit`.
|
| 2528 |
|
| 2529 |
+
For complex conversion specifications such as `%c`, `%x`, or `%X`, or
|
| 2530 |
+
conversion specifications that involve the optional modifiers `E` or
|
| 2531 |
+
`O`, when the function is unable to unambiguously determine some or all
|
| 2532 |
+
`tm` members from the input sequence \[`s`, `end`), it evaluates
|
| 2533 |
+
`err |= ios_base::eofbit`. In such cases the values of those `tm`
|
| 2534 |
members are unspecified and may be outside their valid range.
|
| 2535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2536 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2537 |
recognized as possibly part of a valid input sequence for the given
|
| 2538 |
`format` and `modifier`.
|
| 2539 |
|
| 2540 |
+
*Remarks:* It is unspecified whether multiple calls to `do_get()` with
|
| 2541 |
+
the address of the same `tm` object will update the current contents of
|
| 2542 |
+
the object or simply overwrite its members. Portable programs should
|
| 2543 |
+
zero out the object before invoking the function.
|
| 2544 |
+
|
| 2545 |
#### Class template `time_get_byname` <a id="locale.time.get.byname">[[locale.time.get.byname]]</a>
|
| 2546 |
|
| 2547 |
``` cpp
|
| 2548 |
namespace std {
|
| 2549 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
|
|
|
| 2606 |
interleaved in the output in the order in which they appear in the
|
| 2607 |
pattern. Format sequences are identified by converting each character
|
| 2608 |
`c` to a `char` value as if by `ct.narrow(c, 0)`, where `ct` is a
|
| 2609 |
reference to `ctype<charT>` obtained from `str.getloc()`. The first
|
| 2610 |
character of each sequence is equal to `’%’`, followed by an optional
|
| 2611 |
+
modifier character `mod`[^17]
|
| 2612 |
+
|
| 2613 |
+
and a format specifier character `spec` as defined for the function
|
| 2614 |
+
`strftime`. If no modifier character is present, `mod` is zero. For each
|
| 2615 |
+
valid format sequence identified, calls
|
| 2616 |
`do_put(s, str, fill, t, spec, mod)`.
|
| 2617 |
|
| 2618 |
The second form calls `do_put(s, str, fill, t, format, modifier)`.
|
| 2619 |
|
| 2620 |
+
[*Note 1*: The `fill` argument can be used in the
|
| 2621 |
implementation-defined formats or by derivations. A space character is a
|
| 2622 |
reasonable default for this argument. — *end note*]
|
| 2623 |
|
| 2624 |
*Returns:* An iterator pointing immediately after the last character
|
| 2625 |
produced.
|
|
|
|
| 2633 |
|
| 2634 |
*Effects:* Formats the contents of the parameter `t` into characters
|
| 2635 |
placed on the output sequence `s`. Formatting is controlled by the
|
| 2636 |
parameters `format` and `modifier`, interpreted identically as the
|
| 2637 |
format specifiers in the string argument to the standard library
|
| 2638 |
+
function `strftime()`, except that the sequence of characters produced
|
| 2639 |
+
for those specifiers that are described as depending on the C locale are
|
| 2640 |
+
instead *implementation-defined*.
|
| 2641 |
+
|
| 2642 |
+
[*Note 2*: Interpretation of the `modifier` argument is
|
| 2643 |
+
implementation-defined. — *end note*]
|
| 2644 |
|
| 2645 |
*Returns:* An iterator pointing immediately after the last character
|
| 2646 |
produced.
|
| 2647 |
|
| 2648 |
+
[*Note 3*: The `fill` argument can be used in the
|
| 2649 |
implementation-defined formats or by derivations. A space character is a
|
| 2650 |
reasonable default for this argument. — *end note*]
|
| 2651 |
|
| 2652 |
+
*Recommended practice:* Interpretation of the `modifier` should follow
|
| 2653 |
+
POSIX conventions. Implementations should refer to other standards such
|
| 2654 |
+
as POSIX for a specification of the character sequences produced for
|
| 2655 |
+
those specifiers described as depending on the C locale.
|
| 2656 |
+
|
| 2657 |
#### Class template `time_put_byname` <a id="locale.time.put.byname">[[locale.time.put.byname]]</a>
|
| 2658 |
|
| 2659 |
``` cpp
|
| 2660 |
namespace std {
|
| 2661 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
|
|
|
| 2673 |
}
|
| 2674 |
```
|
| 2675 |
|
| 2676 |
### The monetary category <a id="category.monetary">[[category.monetary]]</a>
|
| 2677 |
|
| 2678 |
+
#### General <a id="category.monetary.general">[[category.monetary.general]]</a>
|
| 2679 |
+
|
| 2680 |
These templates handle monetary formats. A template parameter indicates
|
| 2681 |
whether local or international monetary formats are to be used.
|
| 2682 |
|
| 2683 |
All specifications of member functions for `money_put` and `money_get`
|
| 2684 |
in the subclauses of [[category.monetary]] only apply to the
|
|
|
|
| 2795 |
|
| 2796 |
Digits in the numeric monetary component are extracted and placed in
|
| 2797 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 2798 |
value for `units`, in the order in which they appear, preceded by a
|
| 2799 |
minus sign if and only if the result is negative. The value `units` is
|
| 2800 |
+
produced as if by[^18]
|
| 2801 |
|
| 2802 |
``` cpp
|
| 2803 |
for (int i = 0; i < n; ++i)
|
| 2804 |
buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
|
| 2805 |
buf2[n] = 0;
|
|
|
|
| 2886 |
leading minus sign and the immediately subsequent digit characters (as
|
| 2887 |
classified according to `ct`) are used; any trailing characters
|
| 2888 |
(including digits appearing after a non-digit character) are ignored.
|
| 2889 |
Calls `str.width(0)`.
|
| 2890 |
|
| 2891 |
+
*Returns:* An iterator pointing immediately after the last character
|
| 2892 |
+
produced.
|
| 2893 |
+
|
| 2894 |
*Remarks:* The currency symbol is generated if and only if
|
| 2895 |
`(str.flags() & str.showbase)` is nonzero. If the number of characters
|
| 2896 |
generated for the specified format is less than the value returned by
|
| 2897 |
`str.width()` on entry to the function, then copies of `fill` are
|
| 2898 |
inserted as necessary to pad to the specified width. For the value `af`
|
|
|
|
| 2904 |
|
| 2905 |
[*Note 1*: It is possible, with some combinations of format patterns
|
| 2906 |
and flag values, to produce output that cannot be parsed using
|
| 2907 |
`num_get<>::get`. — *end note*]
|
| 2908 |
|
|
|
|
|
|
|
|
|
|
| 2909 |
#### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
|
| 2910 |
|
| 2911 |
+
##### General <a id="locale.moneypunct.general">[[locale.moneypunct.general]]</a>
|
| 2912 |
+
|
| 2913 |
``` cpp
|
| 2914 |
namespace std {
|
| 2915 |
class money_base {
|
| 2916 |
public:
|
| 2917 |
enum part { none, space, symbol, sign, value };
|
|
|
|
| 2956 |
|
| 2957 |
The `moneypunct<>` facet defines monetary formatting parameters used by
|
| 2958 |
`money_get<>` and `money_put<>`. A monetary format is a sequence of four
|
| 2959 |
components, specified by a `pattern` value `p`, such that the `part`
|
| 2960 |
value `static_cast<part>(p.field[i])` determines the `i`ᵗʰ component of
|
| 2961 |
+
the format[^19]
|
| 2962 |
+
|
| 2963 |
+
In the `field` member of a `pattern` object, each value `symbol`,
|
| 2964 |
+
`sign`, `value`, and either `space` or `none` appears exactly once. The
|
| 2965 |
+
value `none`, if present, is not first; the value `space`, if present,
|
| 2966 |
+
is neither first nor last.
|
| 2967 |
|
| 2968 |
Where `none` or `space` appears, whitespace is permitted in the format,
|
| 2969 |
except where `none` appears at the end, in which case no whitespace is
|
| 2970 |
permitted. The value `space` indicates that at least one space is
|
| 2971 |
required at that position. Where `symbol` appears, the sequence of
|
|
|
|
| 3047 |
``` cpp
|
| 3048 |
charT do_decimal_point() const;
|
| 3049 |
```
|
| 3050 |
|
| 3051 |
*Returns:* The radix separator to use in case `do_frac_digits()` is
|
| 3052 |
+
greater than zero.[^20]
|
| 3053 |
|
| 3054 |
``` cpp
|
| 3055 |
charT do_thousands_sep() const;
|
| 3056 |
```
|
| 3057 |
|
| 3058 |
*Returns:* The digit group separator to use in case `do_grouping()`
|
| 3059 |
+
specifies a digit grouping pattern.[^21]
|
| 3060 |
|
| 3061 |
``` cpp
|
| 3062 |
string do_grouping() const;
|
| 3063 |
```
|
| 3064 |
|
| 3065 |
*Returns:* A pattern defined identically as, but not necessarily equal
|
| 3066 |
+
to, the result of `numpunct<charT>::do_grouping()`.[^22]
|
| 3067 |
|
| 3068 |
``` cpp
|
| 3069 |
string_type do_curr_symbol() const;
|
| 3070 |
```
|
| 3071 |
|
|
|
|
| 3079 |
string_type do_positive_sign() const;
|
| 3080 |
string_type do_negative_sign() const;
|
| 3081 |
```
|
| 3082 |
|
| 3083 |
*Returns:* `do_positive_sign()` returns the string to use to indicate a
|
| 3084 |
+
positive monetary value;[^23]
|
| 3085 |
+
|
| 3086 |
+
`do_negative_sign()` returns the string to use to indicate a negative
|
| 3087 |
+
value.
|
| 3088 |
|
| 3089 |
``` cpp
|
| 3090 |
int do_frac_digits() const;
|
| 3091 |
```
|
| 3092 |
|
| 3093 |
*Returns:* The number of digits after the decimal radix separator, if
|
| 3094 |
+
any.[^24]
|
| 3095 |
|
| 3096 |
``` cpp
|
| 3097 |
pattern do_pos_format() const;
|
| 3098 |
pattern do_neg_format() const;
|
| 3099 |
```
|
|
|
|
| 3105 |
- `moneypunct<wchar_t>`,
|
| 3106 |
- `moneypunct<char, true>`, and
|
| 3107 |
- `moneypunct<wchar_t, true>`,
|
| 3108 |
|
| 3109 |
return an object of type `pattern` initialized to
|
| 3110 |
+
`{ symbol, sign, none, value }`.[^25]
|
| 3111 |
|
| 3112 |
#### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
|
| 3113 |
|
| 3114 |
``` cpp
|
| 3115 |
namespace std {
|
|
|
|
| 3128 |
}
|
| 3129 |
```
|
| 3130 |
|
| 3131 |
### The message retrieval category <a id="category.messages">[[category.messages]]</a>
|
| 3132 |
|
| 3133 |
+
#### General <a id="category.messages.general">[[category.messages.general]]</a>
|
| 3134 |
+
|
| 3135 |
Class `messages<charT>` implements retrieval of strings from message
|
| 3136 |
catalogs.
|
| 3137 |
|
| 3138 |
#### Class template `messages` <a id="locale.messages">[[locale.messages]]</a>
|
| 3139 |
|
| 3140 |
+
##### General <a id="locale.messages.general">[[locale.messages.general]]</a>
|
| 3141 |
+
|
| 3142 |
``` cpp
|
| 3143 |
namespace std {
|
| 3144 |
class messages_base {
|
| 3145 |
public:
|
| 3146 |
using catalog = unspecified signed integer type;
|
|
|
|
| 3274 |
```
|
| 3275 |
|
| 3276 |
The contents and meaning of the header `<clocale>` are the same as the C
|
| 3277 |
standard library header `<locale.h>`.
|
| 3278 |
|
| 3279 |
+
### Data races <a id="clocale.data.races">[[clocale.data.races]]</a>
|
| 3280 |
+
|
| 3281 |
Calls to the function `setlocale` may introduce a data race
|
| 3282 |
[[res.on.data.races]] with other calls to `setlocale` or with calls to
|
| 3283 |
the functions listed in [[setlocale.data.races]].
|
| 3284 |
|
| 3285 |
See also: ISO C 7.11
|
|
|
|
| 3308 |
[bitmask.types]: library.md#bitmask.types
|
| 3309 |
[c.files]: input.md#c.files
|
| 3310 |
[c.locales]: #c.locales
|
| 3311 |
[category.collate]: #category.collate
|
| 3312 |
[category.ctype]: #category.ctype
|
| 3313 |
+
[category.ctype.general]: #category.ctype.general
|
| 3314 |
[category.messages]: #category.messages
|
| 3315 |
+
[category.messages.general]: #category.messages.general
|
| 3316 |
[category.monetary]: #category.monetary
|
| 3317 |
+
[category.monetary.general]: #category.monetary.general
|
| 3318 |
[category.numeric]: #category.numeric
|
| 3319 |
+
[category.numeric.general]: #category.numeric.general
|
| 3320 |
[category.time]: #category.time
|
| 3321 |
+
[category.time.general]: #category.time.general
|
| 3322 |
[classification]: #classification
|
| 3323 |
+
[clocale.data.races]: #clocale.data.races
|
| 3324 |
[clocale.syn]: #clocale.syn
|
|
|
|
| 3325 |
[conversions.character]: #conversions.character
|
| 3326 |
[facet.ctype.char.dtor]: #facet.ctype.char.dtor
|
| 3327 |
[facet.ctype.char.members]: #facet.ctype.char.members
|
| 3328 |
[facet.ctype.char.statics]: #facet.ctype.char.statics
|
| 3329 |
[facet.ctype.char.virtuals]: #facet.ctype.char.virtuals
|
| 3330 |
[facet.ctype.special]: #facet.ctype.special
|
| 3331 |
+
[facet.ctype.special.general]: #facet.ctype.special.general
|
| 3332 |
[facet.num.get.members]: #facet.num.get.members
|
| 3333 |
[facet.num.get.virtuals]: #facet.num.get.virtuals
|
| 3334 |
[facet.num.put.members]: #facet.num.put.members
|
| 3335 |
[facet.num.put.virtuals]: #facet.num.put.virtuals
|
| 3336 |
[facet.numpunct]: #facet.numpunct
|
|
|
|
| 3342 |
[istream.formatted.reqmts]: input.md#istream.formatted.reqmts
|
| 3343 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 3344 |
[lex.charset]: lex.md#lex.charset
|
| 3345 |
[locale]: #locale
|
| 3346 |
[locale.categories]: #locale.categories
|
| 3347 |
+
[locale.categories.general]: #locale.categories.general
|
| 3348 |
[locale.category]: #locale.category
|
| 3349 |
[locale.category.facets]: #locale.category.facets
|
| 3350 |
[locale.codecvt]: #locale.codecvt
|
| 3351 |
[locale.codecvt.byname]: #locale.codecvt.byname
|
| 3352 |
+
[locale.codecvt.general]: #locale.codecvt.general
|
| 3353 |
[locale.codecvt.inout]: #locale.codecvt.inout
|
| 3354 |
[locale.codecvt.members]: #locale.codecvt.members
|
| 3355 |
[locale.codecvt.unshift]: #locale.codecvt.unshift
|
| 3356 |
[locale.codecvt.virtuals]: #locale.codecvt.virtuals
|
| 3357 |
[locale.collate]: #locale.collate
|
| 3358 |
[locale.collate.byname]: #locale.collate.byname
|
| 3359 |
+
[locale.collate.general]: #locale.collate.general
|
| 3360 |
[locale.collate.members]: #locale.collate.members
|
| 3361 |
[locale.collate.virtuals]: #locale.collate.virtuals
|
| 3362 |
[locale.cons]: #locale.cons
|
| 3363 |
[locale.convenience]: #locale.convenience
|
| 3364 |
[locale.ctype]: #locale.ctype
|
| 3365 |
[locale.ctype.byname]: #locale.ctype.byname
|
| 3366 |
+
[locale.ctype.general]: #locale.ctype.general
|
| 3367 |
[locale.ctype.members]: #locale.ctype.members
|
| 3368 |
[locale.ctype.virtuals]: #locale.ctype.virtuals
|
| 3369 |
[locale.facet]: #locale.facet
|
| 3370 |
+
[locale.general]: #locale.general
|
| 3371 |
[locale.global.templates]: #locale.global.templates
|
| 3372 |
[locale.id]: #locale.id
|
| 3373 |
[locale.members]: #locale.members
|
| 3374 |
[locale.messages]: #locale.messages
|
| 3375 |
[locale.messages.byname]: #locale.messages.byname
|
| 3376 |
+
[locale.messages.general]: #locale.messages.general
|
| 3377 |
[locale.messages.members]: #locale.messages.members
|
| 3378 |
[locale.messages.virtuals]: #locale.messages.virtuals
|
| 3379 |
[locale.money.get]: #locale.money.get
|
| 3380 |
[locale.money.get.members]: #locale.money.get.members
|
| 3381 |
[locale.money.get.virtuals]: #locale.money.get.virtuals
|
| 3382 |
[locale.money.put]: #locale.money.put
|
| 3383 |
[locale.money.put.members]: #locale.money.put.members
|
| 3384 |
[locale.money.put.virtuals]: #locale.money.put.virtuals
|
| 3385 |
[locale.moneypunct]: #locale.moneypunct
|
| 3386 |
[locale.moneypunct.byname]: #locale.moneypunct.byname
|
| 3387 |
+
[locale.moneypunct.general]: #locale.moneypunct.general
|
| 3388 |
[locale.moneypunct.members]: #locale.moneypunct.members
|
| 3389 |
[locale.moneypunct.virtuals]: #locale.moneypunct.virtuals
|
| 3390 |
[locale.nm.put]: #locale.nm.put
|
| 3391 |
+
[locale.nm.put.general]: #locale.nm.put.general
|
| 3392 |
[locale.num.get]: #locale.num.get
|
| 3393 |
+
[locale.num.get.general]: #locale.num.get.general
|
| 3394 |
[locale.numpunct]: #locale.numpunct
|
| 3395 |
[locale.numpunct.byname]: #locale.numpunct.byname
|
| 3396 |
+
[locale.numpunct.general]: #locale.numpunct.general
|
| 3397 |
[locale.operators]: #locale.operators
|
| 3398 |
[locale.spec]: #locale.spec
|
| 3399 |
[locale.statics]: #locale.statics
|
| 3400 |
[locale.syn]: #locale.syn
|
| 3401 |
[locale.time.get]: #locale.time.get
|
| 3402 |
[locale.time.get.byname]: #locale.time.get.byname
|
| 3403 |
[locale.time.get.dogetdate]: #locale.time.get.dogetdate
|
| 3404 |
+
[locale.time.get.general]: #locale.time.get.general
|
| 3405 |
[locale.time.get.members]: #locale.time.get.members
|
| 3406 |
[locale.time.get.virtuals]: #locale.time.get.virtuals
|
| 3407 |
[locale.time.put]: #locale.time.put
|
| 3408 |
[locale.time.put.byname]: #locale.time.put.byname
|
| 3409 |
[locale.time.put.members]: #locale.time.put.members
|
|
|
|
| 3419 |
[setlocale.data.races]: #setlocale.data.races
|
| 3420 |
[tab:locale.category.facets]: #tab:locale.category.facets
|
| 3421 |
[tab:locale.spec]: #tab:locale.spec
|
| 3422 |
[vector]: containers.md#vector
|
| 3423 |
|
| 3424 |
+
[^1]: In this subclause, the type name `tm` is an incomplete type that
|
| 3425 |
+
is defined in `<ctime>`.
|
| 3426 |
|
| 3427 |
[^2]: Note that in the call to `put`, the stream is implicitly converted
|
| 3428 |
to an `ostreambuf_iterator<charT, traits>`.
|
| 3429 |
|
| 3430 |
[^3]: This is a complete list of requirements; there are no other
|
|
|
|
| 3432 |
constructor, assignment, default constructor, destructor, etc.
|
| 3433 |
|
| 3434 |
[^4]: When used in a loop, it is faster to cache the `ctype<>` facet and
|
| 3435 |
use it directly, or use the vector form of `ctype<>::is`.
|
| 3436 |
|
| 3437 |
+
[^5]: The parameter `c` of `do_widen` is intended to accept values
|
| 3438 |
derived from *character-literal*s for conversion to the locale’s
|
| 3439 |
encoding.
|
| 3440 |
|
| 3441 |
[^6]: In other words, the transformed character is not a member of any
|
| 3442 |
character classification that `c` is not also a member of.
|
|
|
|
| 3445 |
provided. The specialization is specified in the standard, and not
|
| 3446 |
left as an implementation detail, because it affects the derivation
|
| 3447 |
interface for `ctype<char>`.
|
| 3448 |
|
| 3449 |
[^8]: Informally, this means that `basic_filebuf` assumes that the
|
| 3450 |
+
mappings from internal to external characters is 1 to N: that a
|
| 3451 |
+
`codecvt` facet that is used by `basic_filebuf` can translate
|
| 3452 |
characters one internal character at a time.
|
| 3453 |
|
| 3454 |
[^9]: Typically these will be characters to return the state to
|
| 3455 |
`stateT()`.
|
| 3456 |
|
| 3457 |
[^10]: If `encoding()` yields `-1`, then more than `max_length()`
|
| 3458 |
+
`externT` elements can be consumed when producing a single `internT`
|
| 3459 |
+
character, and additional `externT` elements can appear at the end
|
| 3460 |
of a sequence after those that yield the final `internT` character.
|
| 3461 |
|
| 3462 |
[^11]: Parsing `"-1"` correctly into, e.g., an `unsigned short` requires
|
| 3463 |
that the corresponding member `get()` at least extract the sign
|
| 3464 |
before delegating.
|
|
|
|
| 3477 |
parsing of user-entered dates and times, but machine-generated
|
| 3478 |
formats can be parsed reliably. This allows parsers to be aggressive
|
| 3479 |
about interpreting user variations on standard formats.
|
| 3480 |
|
| 3481 |
[^16]: This function is intended as a convenience only, for common
|
| 3482 |
+
formats, and can return `no_order` in valid locales.
|
| 3483 |
|
| 3484 |
[^17]: Although the C programming language defines no modifiers, most
|
| 3485 |
vendors do.
|
| 3486 |
|
| 3487 |
+
[^18]: The semantics here are different from `ct.narrow`.
|
|
|
|
| 3488 |
|
| 3489 |
+
[^19]: An array of `char`, rather than an array of `part`, is specified
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3490 |
for `pattern::field` purely for efficiency.
|
| 3491 |
|
| 3492 |
+
[^20]: In common U.S. locales this is `’.’`.
|
| 3493 |
|
| 3494 |
+
[^21]: In common U.S. locales this is `’,’`.
|
| 3495 |
|
| 3496 |
+
[^22]: To specify grouping by 3s, the value is `"\003"` *not* `"3"`.
|
| 3497 |
|
| 3498 |
+
[^23]: This is usually the empty string.
|
| 3499 |
|
| 3500 |
+
[^24]: In common U.S. locales, this is 2.
|
| 3501 |
|
| 3502 |
+
[^25]: Note that the international symbol returned by `do_curr_symbol()`
|
| 3503 |
usually contains a space, itself; for example, `"USD "`.
|