tmp/tmp8x09pzzw/{from.md → to.md}
RENAMED
|
@@ -1,68 +0,0 @@
|
|
| 1 |
-
### Primitive numeric input conversion <a id="utility.from.chars">[[utility.from.chars]]</a>
|
| 2 |
-
|
| 3 |
-
All functions named `from_chars` analyze the string \[`first`, `last`)
|
| 4 |
-
for a pattern, where \[`first`, `last`) is required to be a valid range.
|
| 5 |
-
If no characters match the pattern, `value` is unmodified, the member
|
| 6 |
-
`ptr` of the return value is `first` and the member `ec` is equal to
|
| 7 |
-
`errc::invalid_argument`. Otherwise, the characters matching the pattern
|
| 8 |
-
are interpreted as a representation of a value of the type of `value`.
|
| 9 |
-
The member `ptr` of the return value points to the first character not
|
| 10 |
-
matching the pattern, or has the value `last` if all characters match.
|
| 11 |
-
If the parsed value is not in the range representable by the type of
|
| 12 |
-
`value`, `value` is unmodified and the member `ec` of the return value
|
| 13 |
-
is equal to `errc::result_out_of_range`. Otherwise, `value` is set to
|
| 14 |
-
the parsed value and the member `ec` is set such that the conversion to
|
| 15 |
-
`bool` yields `false`.
|
| 16 |
-
|
| 17 |
-
``` cpp
|
| 18 |
-
from_chars_result from_chars(const char* first, const char* last,
|
| 19 |
-
see below& value, int base = 10);
|
| 20 |
-
```
|
| 21 |
-
|
| 22 |
-
*Requires:* `base` has a value between 2 and 36 (inclusive).
|
| 23 |
-
|
| 24 |
-
*Effects:* The pattern is the expected form of the subject sequence in
|
| 25 |
-
the `"C"` locale for the given nonzero base, as described for `strtol`,
|
| 26 |
-
except that no `"0x"` or `"0X"` prefix shall appear if the value of
|
| 27 |
-
`base` is 16, and except that a minus sign is the only sign that may
|
| 28 |
-
appear, and only if `value` has a signed type.
|
| 29 |
-
|
| 30 |
-
*Throws:* Nothing.
|
| 31 |
-
|
| 32 |
-
*Remarks:* The implementation shall provide overloads for all signed and
|
| 33 |
-
unsigned integer types and `char` as the referenced type of the
|
| 34 |
-
parameter `value`.
|
| 35 |
-
|
| 36 |
-
``` cpp
|
| 37 |
-
from_chars_result from_chars(const char* first, const char* last, float& value,
|
| 38 |
-
chars_format fmt = chars_format::general);
|
| 39 |
-
from_chars_result from_chars(const char* first, const char* last, double& value,
|
| 40 |
-
chars_format fmt = chars_format::general);
|
| 41 |
-
from_chars_result from_chars(const char* first, const char* last, long double& value,
|
| 42 |
-
chars_format fmt = chars_format::general);
|
| 43 |
-
```
|
| 44 |
-
|
| 45 |
-
*Requires:* `fmt` has the value of one of the enumerators of
|
| 46 |
-
`chars_format`.
|
| 47 |
-
|
| 48 |
-
*Effects:* The pattern is the expected form of the subject sequence in
|
| 49 |
-
the `"C"` locale, as described for `strtod`, except that
|
| 50 |
-
|
| 51 |
-
- the only sign that may appear is a minus sign;
|
| 52 |
-
- if `fmt` has `chars_format::scientific` set but not
|
| 53 |
-
`chars_format::fixed`, the otherwise optional exponent part shall
|
| 54 |
-
appear;
|
| 55 |
-
- if `fmt` has `chars_format::fixed` set but not
|
| 56 |
-
`chars_format::scientific`, the optional exponent part shall not
|
| 57 |
-
appear; and
|
| 58 |
-
- if `fmt` is `chars_format::hex`, the prefix `"0x"` or `"0X"` is
|
| 59 |
-
assumed. \[*Example 1*: The string `0x123` is parsed to have the value
|
| 60 |
-
`0` with remaining characters `x123`. — *end example*]
|
| 61 |
-
|
| 62 |
-
In any case, the resulting `value` is one of at most two floating-point
|
| 63 |
-
values closest to the value of the string matching the pattern.
|
| 64 |
-
|
| 65 |
-
*Throws:* Nothing.
|
| 66 |
-
|
| 67 |
-
ISO C 7.22.1.3, ISO C 7.22.1.4.
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|