[charconv.syn] # 28 Text processing library [[text]](./#text) ## 28.2 Primitive numeric conversions [[charconv]](charconv#syn) ### 28.2.1 Header 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.2 Fundamental 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.1 Header synopsis [charconv.syn]") {[scientific](#lib:chars_format,scientific "28.2.1 Header synopsis [charconv.syn]") = *unspecified*, [fixed](#lib:chars_format,fixed "28.2.1 Header synopsis [charconv.syn]") = *unspecified*, [hex](#lib:chars_format,hex "28.2.1 Header synopsis [charconv.syn]") = *unspecified*, [general](#lib:chars_format,general "28.2.1 Header synopsis [charconv.syn]") = fixed | scientific }; // [[charconv.to.chars]](charconv.to.chars "28.2.2 Primitive numeric output conversion"), primitive numerical output conversionstruct [to_chars_result](#lib:to_chars_result "28.2.1 Header synopsis [charconv.syn]") { // freestandingchar* [ptr](#lib:to_chars_result,ptr "28.2.1 Header synopsis [charconv.syn]"); errc [ec](#lib:to_chars_result,ec "28.2.1 Header 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.3 Primitive numeric input conversion"), primitive numerical input conversionstruct [from_chars_result](#lib:from_chars_result "28.2.1 Header synopsis [charconv.syn]") { // freestandingconst char* [ptr](#lib:from_chars_result,ptr "28.2.1 Header synopsis [charconv.syn]"); errc [ec](#lib:from_chars_result,ec "28.2.1 Header 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.3 Bitmask 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)