tmp/tmpt3tep5bj/{from.md → to.md}
RENAMED
|
@@ -1,59 +1,58 @@
|
|
| 1 |
### Header `<charconv>` synopsis <a id="charconv.syn">[[charconv.syn]]</a>
|
| 2 |
|
| 3 |
When a function is specified with a type placeholder of `integer-type`,
|
| 4 |
-
the implementation provides overloads for all cv-unqualified
|
| 5 |
-
unsigned integer types
|
| 6 |
function is specified with a type placeholder of `floating-point-type`,
|
| 7 |
the implementation provides overloads for all cv-unqualified
|
| 8 |
floating-point types [[basic.fundamental]] in lieu of
|
| 9 |
`floating-point-type`.
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
-
|
| 13 |
-
%
|
| 14 |
-
{chars_format{chars_format{chars_format{chars_formatnamespace std {
|
| 15 |
// floating-point format for primitive numerical conversion
|
| 16 |
enum class chars_format {
|
| 17 |
scientific = unspecified,
|
| 18 |
fixed = unspecified,
|
| 19 |
hex = unspecified,
|
| 20 |
general = fixed | scientific
|
| 21 |
};
|
| 22 |
-
%
|
| 23 |
-
%
|
| 24 |
-
{to_chars_result{to_chars_result}
|
| 25 |
|
| 26 |
// [charconv.to.chars], primitive numerical output conversion
|
| 27 |
-
struct to_chars_result {
|
| 28 |
char* ptr;
|
| 29 |
errc ec;
|
| 30 |
friend bool operator==(const to_chars_result&, const to_chars_result&) = default;
|
|
|
|
| 31 |
};
|
| 32 |
|
| 33 |
-
constexpr to_chars_result to_chars(char* first, char* last,
|
| 34 |
-
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
to_chars_result to_chars(char* first, char* last,
|
| 37 |
-
|
| 38 |
-
to_chars_result to_chars(char* first, char* last,
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
{from_chars_result{from_chars_result}
|
| 43 |
|
| 44 |
// [charconv.from.chars], primitive numerical input conversion
|
| 45 |
-
struct from_chars_result {
|
| 46 |
const char* ptr;
|
| 47 |
errc ec;
|
| 48 |
friend bool operator==(const from_chars_result&, const from_chars_result&) = default;
|
|
|
|
| 49 |
};
|
| 50 |
|
| 51 |
-
constexpr from_chars_result from_chars(const char* first, const char* last,
|
| 52 |
integer-type& value, int base = 10);
|
| 53 |
|
| 54 |
-
from_chars_result from_chars(const char* first, const char* last,
|
|
|
|
| 55 |
chars_format fmt = chars_format::general);
|
| 56 |
}
|
| 57 |
```
|
| 58 |
|
| 59 |
The type `chars_format` is a bitmask type [[bitmask.types]] with
|
|
|
|
| 1 |
### Header `<charconv>` synopsis <a id="charconv.syn">[[charconv.syn]]</a>
|
| 2 |
|
| 3 |
When a function is specified with a type placeholder of `integer-type`,
|
| 4 |
+
the implementation provides overloads for `char` and all cv-unqualified
|
| 5 |
+
signed and unsigned integer types in lieu of `integer-type`. When a
|
| 6 |
function is specified with a type placeholder of `floating-point-type`,
|
| 7 |
the implementation provides overloads for all cv-unqualified
|
| 8 |
floating-point types [[basic.fundamental]] in lieu of
|
| 9 |
`floating-point-type`.
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
+
namespace std {
|
|
|
|
|
|
|
| 13 |
// floating-point format for primitive numerical conversion
|
| 14 |
enum class chars_format {
|
| 15 |
scientific = unspecified,
|
| 16 |
fixed = unspecified,
|
| 17 |
hex = unspecified,
|
| 18 |
general = fixed | scientific
|
| 19 |
};
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
// [charconv.to.chars], primitive numerical output conversion
|
| 22 |
+
struct to_chars_result { // freestanding
|
| 23 |
char* ptr;
|
| 24 |
errc ec;
|
| 25 |
friend bool operator==(const to_chars_result&, const to_chars_result&) = default;
|
| 26 |
+
constexpr explicit operator bool() const noexcept { return ec == errc{}; }
|
| 27 |
};
|
| 28 |
|
| 29 |
+
constexpr to_chars_result to_chars(char* first, char* last, // freestanding
|
| 30 |
+
integer-type value, int base = 10);
|
| 31 |
+
to_chars_result to_chars(char* first, char* last, // freestanding
|
| 32 |
+
bool value, int base = 10) = delete;
|
| 33 |
|
| 34 |
+
to_chars_result to_chars(char* first, char* last, // freestanding-deleted
|
| 35 |
+
floating-point-type value);
|
| 36 |
+
to_chars_result to_chars(char* first, char* last, // freestanding-deleted
|
| 37 |
+
floating-point-type value, chars_format fmt);
|
| 38 |
+
to_chars_result to_chars(char* first, char* last, // freestanding-deleted
|
| 39 |
+
floating-point-type value, chars_format fmt, int precision);
|
|
|
|
| 40 |
|
| 41 |
// [charconv.from.chars], primitive numerical input conversion
|
| 42 |
+
struct from_chars_result { // freestanding
|
| 43 |
const char* ptr;
|
| 44 |
errc ec;
|
| 45 |
friend bool operator==(const from_chars_result&, const from_chars_result&) = default;
|
| 46 |
+
constexpr explicit operator bool() const noexcept { return ec == errc{}; }
|
| 47 |
};
|
| 48 |
|
| 49 |
+
constexpr from_chars_result from_chars(const char* first, const char* last, // freestanding
|
| 50 |
integer-type& value, int base = 10);
|
| 51 |
|
| 52 |
+
from_chars_result from_chars(const char* first, const char* last, // freestanding-deleted
|
| 53 |
+
floating-point-type& value,
|
| 54 |
chars_format fmt = chars_format::general);
|
| 55 |
}
|
| 56 |
```
|
| 57 |
|
| 58 |
The type `chars_format` is a bitmask type [[bitmask.types]] with
|