Files
cppdraft_translate/cppdraft/charconv/syn.md
2025-10-25 03:02:53 +03:00

4.0 KiB

[charconv.syn]

28 Text processing library [text]

28.2 Primitive numeric conversions [charconv]

28.2.1 Header synopsis [charconv.syn]

1

#

When a function is specified with a type placeholder of integer-type, the implementation provides overloads for char and all cv-unqualified signed and unsigned integer types in lieu of integer-type.

When a function is specified with a type placeholder of floating-point-type, the implementation provides overloads for all cv-unqualified floating-point types ([basic.fundamental]) in lieu of floating-point-type.

🔗

namespace std {// floating-point format for primitive numerical conversionenum class chars_format {scientific = unspecified, fixed = unspecified, hex = unspecified, general = fixed | scientific }; // [charconv.to.chars], primitive numerical output conversionstruct to_chars_result { // freestandingchar* ptr; errc ec; friend bool operator==(const to_chars_result&, const to_chars_result&) = default; constexpr explicit operator bool() const noexcept { return ec == errc{}; }}; constexpr to_chars_result to_chars(char* first, char* last, // freestandinginteger-type value, int base = 10); to_chars_result to_chars(char* first, char* last, // freestandingbool value, int base = 10) = delete;

to_chars_result to_chars(char* first, char* last, // freestanding-deletedfloating-point-type value); to_chars_result to_chars(char* first, char* last, // freestanding-deletedfloating-point-type value, chars_format fmt); to_chars_result to_chars(char* first, char* last, // freestanding-deletedfloating-point-type value, chars_format fmt, int precision); // [charconv.from.chars], primitive numerical input conversionstruct from_chars_result { // freestandingconst char* ptr; errc ec; friend bool operator==(const from_chars_result&, const from_chars_result&) = default; constexpr explicit operator bool() const noexcept { return ec == errc{}; }}; constexpr from_chars_result from_chars(const char* first, const char* last, // freestandinginteger-type& value, int base = 10);

from_chars_result from_chars(const char* first, const char* last, // freestanding-deletedfloating-point-type& value, chars_format fmt = chars_format::general);}

2

#

The type chars_format is a bitmask type ([bitmask.types]) with elements scientific, fixed, and hex.

3

#

The types to_chars_result and from_chars_result have the data members and special members specified above.

They have no base classes or members other than those specified.