This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

52
cppdraft/charconv/syn.md Normal file
View File

@@ -0,0 +1,52 @@
[charconv.syn]
# 28 Text processing library [[text]](./#text)
## 28.2 Primitive numeric conversions [[charconv]](charconv#syn)
### 28.2.1 Header <charconv> synopsis [charconv.syn]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L24)
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*[.](#1.sentence-1)
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]](basic.fundamental "6.9.2Fundamental types"))
in lieu of *floating-point-type*[.](#1.sentence-2)
[🔗](#header:%3ccharconv%3e)
namespace std {// floating-point format for primitive numerical conversionenum class [chars_format](#lib:chars_format "28.2.1Header <charconv> synopsis[charconv.syn]") {[scientific](#lib:chars_format,scientific "28.2.1Header <charconv> synopsis[charconv.syn]") = *unspecified*, [fixed](#lib:chars_format,fixed "28.2.1Header <charconv> synopsis[charconv.syn]") = *unspecified*, [hex](#lib:chars_format,hex "28.2.1Header <charconv> synopsis[charconv.syn]") = *unspecified*, [general](#lib:chars_format,general "28.2.1Header <charconv> synopsis[charconv.syn]") = fixed | scientific }; // [[charconv.to.chars]](charconv.to.chars "28.2.2Primitive numeric output conversion"), primitive numerical output conversionstruct [to_chars_result](#lib:to_chars_result "28.2.1Header <charconv> synopsis[charconv.syn]") { // freestandingchar* [ptr](#lib:to_chars_result,ptr "28.2.1Header <charconv> synopsis[charconv.syn]");
errc [ec](#lib:to_chars_result,ec "28.2.1Header <charconv> synopsis[charconv.syn]"); 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, // freestanding*integer-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-deleted*floating-point-type* value);
to_chars_result to_chars(char* first, char* last, // freestanding-deleted*floating-point-type* value, chars_format fmt);
to_chars_result to_chars(char* first, char* last, // freestanding-deleted*floating-point-type* value, chars_format fmt, int precision); // [[charconv.from.chars]](charconv.from.chars "28.2.3Primitive numeric input conversion"), primitive numerical input conversionstruct [from_chars_result](#lib:from_chars_result "28.2.1Header <charconv> synopsis[charconv.syn]") { // freestandingconst char* [ptr](#lib:from_chars_result,ptr "28.2.1Header <charconv> synopsis[charconv.syn]");
errc [ec](#lib:from_chars_result,ec "28.2.1Header <charconv> synopsis[charconv.syn]"); 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, // freestanding*integer-type*& value, int base = 10);
from_chars_result from_chars(const char* first, const char* last, // freestanding-deleted*floating-point-type*& value,
chars_format fmt = chars_format::general);}
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L84)
The type chars_format is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3Bitmask types"))
with elements scientific, fixed, and hex[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L88)
The types to_chars_result and from_chars_result have the data members and special members specified above[.](#3.sentence-1)
They have no base classes or members other than those specified[.](#3.sentence-2)