Subclause | Header | ||
Primitive numeric conversions | <charconv> | ||
Localization library | <locale>, <clocale> | ||
Formatting | <format> | ||
Text encodings identification | <text_encoding> | ||
Regular expressions library | <regex> | ||
Null-terminated sequence utilities | <cctype>, <cstdlib>, <cuchar>, <cwchar>, <cwctype> |
constexpr to_chars_result to_chars(char* first, char* last, integer-type value, int base = 10);
to_chars_result to_chars(char* first, char* last, floating-point-type value);
to_chars_result to_chars(char* first, char* last, floating-point-type value, chars_format fmt);
to_chars_result to_chars(char* first, char* last, floating-point-type value,
chars_format fmt, int precision);
constexpr from_chars_result from_chars(const char* first, const char* last,
integer-type& value, int base = 10);
from_chars_result from_chars(const char* first, const char* last, floating-point-type& value,
chars_format fmt = chars_format::general);
Subclause | Header | ||
Locales | <locale> | ||
Standard locale categories | |||
C library locales | <clocale> | ||
using category = int;
Category | Includes facets | |
collate | collate<char>, collate<wchar_t> | |
ctype | ctype<char>, ctype<wchar_t> | |
codecvt<char, char, mbstate_t> | ||
codecvt<wchar_t, char, mbstate_t> | ||
monetary | moneypunct<char>, moneypunct<wchar_t> | |
moneypunct<char, true>, moneypunct<wchar_t, true> | ||
money_get<char>, money_get<wchar_t> | ||
money_put<char>, money_put<wchar_t> | ||
numeric | numpunct<char>, numpunct<wchar_t> | |
num_get<char>, num_get<wchar_t> | ||
num_put<char>, num_put<wchar_t> | ||
time | time_get<char>, time_get<wchar_t> | |
time_put<char>, time_put<wchar_t> | ||
messages | messages<char>, messages<wchar_t> |
Category | Includes facets | |
collate | collate_byname<char>, collate_byname<wchar_t> | |
ctype | ctype_byname<char>, ctype_byname<wchar_t> | |
codecvt_byname<char, char, mbstate_t> | ||
codecvt_byname<wchar_t, char, mbstate_t> | ||
monetary | moneypunct_byname<char, International> | |
moneypunct_byname<wchar_t, International> | ||
money_get<C, InputIterator> | ||
money_put<C, OutputIterator> | ||
numeric | numpunct_byname<char>, numpunct_byname<wchar_t> | |
num_get<C, InputIterator>, num_put<C, OutputIterator> | ||
time | time_get<char, InputIterator> | |
time_get_byname<char, InputIterator> | ||
time_get<wchar_t, InputIterator> | ||
time_get_byname<wchar_t, InputIterator> | ||
time_put<char, OutputIterator> | ||
time_put_byname<char, OutputIterator> | ||
time_put<wchar_t, OutputIterator> | ||
time_put_byname<wchar_t, OutputIterator> | ||
messages | messages_byname<char>, messages_byname<wchar_t> |
locale() noexcept;
explicit locale(const char* std_name);
explicit locale(const string& std_name);
locale(const locale& other, const char* std_name, category cats);
locale(const locale& other, const string& std_name, category cats);
template<class Facet> locale(const locale& other, Facet* f);
locale(const locale& other, const locale& one, category cats);
const locale& operator=(const locale& other) noexcept;
template<class Facet> locale combine(const locale& other) const;
string name() const;
text_encoding encoding() const;
bool operator==(const locale& other) const;
template<class charT, class traits, class Allocator>
bool operator()(const basic_string<charT, traits, Allocator>& s1,
const basic_string<charT, traits, Allocator>& s2) const;
static locale global(const locale& loc);
static const locale& classic();
template<class Facet> const Facet& use_facet(const locale& loc);
template<class Facet> bool has_facet(const locale& loc) noexcept;
template<class charT> bool isspace (charT c, const locale& loc);
template<class charT> bool isprint (charT c, const locale& loc);
template<class charT> bool iscntrl (charT c, const locale& loc);
template<class charT> bool isupper (charT c, const locale& loc);
template<class charT> bool islower (charT c, const locale& loc);
template<class charT> bool isalpha (charT c, const locale& loc);
template<class charT> bool isdigit (charT c, const locale& loc);
template<class charT> bool ispunct (charT c, const locale& loc);
template<class charT> bool isxdigit(charT c, const locale& loc);
template<class charT> bool isalnum (charT c, const locale& loc);
template<class charT> bool isgraph (charT c, const locale& loc);
template<class charT> bool isblank (charT c, const locale& loc);
template<class charT> charT toupper(charT c, const locale& loc);
template<class charT> charT tolower(charT c, const locale& loc);
bool is(mask m, charT c) const;
const charT* is(const charT* low, const charT* high, mask* vec) const;
const charT* scan_is(mask m, const charT* low, const charT* high) const;
const charT* scan_not(mask m, const charT* low, const charT* high) const;
charT toupper(charT c) const;
const charT* toupper(charT* low, const charT* high) const;
charT tolower(charT c) const;
const charT* tolower(charT* low, const charT* high) const;
charT widen(char c) const;
const char* widen(const char* low, const char* high, charT* to) const;
char narrow(charT c, char dfault) const;
const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const;
bool do_is(mask m, charT c) const;
const charT* do_is(const charT* low, const charT* high, mask* vec) const;
const charT* do_scan_is(mask m, const charT* low, const charT* high) const;
const charT* do_scan_not(mask m, const charT* low, const charT* high) const;
charT do_toupper(charT c) const;
const charT* do_toupper(charT* low, const charT* high) const;
charT do_tolower(charT c) const;
const charT* do_tolower(charT* low, const charT* high) const;
charT do_widen(char c) const;
const char* do_widen(const char* low, const char* high, charT* dest) const;
char do_narrow(charT c, char dfault) const;
const charT* do_narrow(const charT* low, const charT* high, char dfault, char* dest) const;
~ctype();
explicit ctype(const mask* tbl = nullptr, bool del = false, size_t refs = 0);
bool is(mask m, char c) const;
const char* is(const char* low, const char* high, mask* vec) const;
const char* scan_is(mask m, const char* low, const char* high) const;
const char* scan_not(mask m, const char* low, const char* high) const;
char toupper(char c) const;
const char* toupper(char* low, const char* high) const;
char tolower(char c) const;
const char* tolower(char* low, const char* high) const;
char widen(char c) const;
const char* widen(const char* low, const char* high, char* to) const;
char narrow(char c, char dfault) const;
const char* narrow(const char* low, const char* high, char dfault, char* to) const;
const mask* table() const noexcept;
static const mask* classic_table() noexcept;
result out(
stateT& state,
const internT* from, const internT* from_end, const internT*& from_next,
externT* to, externT* to_end, externT*& to_next) const;
result unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
result in(
stateT& state,
const externT* from, const externT* from_end, const externT*& from_next,
internT* to, internT* to_end, internT*& to_next) const;
int encoding() const noexcept;
bool always_noconv() const noexcept;
int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
int max_length() const noexcept;
result do_out(
stateT& state,
const internT* from, const internT* from_end, const internT*& from_next,
externT* to, externT* to_end, externT*& to_next) const;
result do_in(
stateT& state,
const externT* from, const externT* from_end, const externT*& from_next,
internT* to, internT* to_end, internT*& to_next) const;
Value | Meaning | |
ok | completed the conversion | |
partial | not all source characters converted | |
error | encountered a character in [from, from_end)
that cannot be converted | |
noconv | internT and externT are the same type, and input
sequence is identical to converted sequence |
result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
Value | Meaning | |
ok | completed the sequence | |
partial | space for more than to_end - to destination elements was needed
to terminate a sequence given the value of state | |
error | an unspecified error has occurred | |
noconv | no termination is needed for this state_type |
int do_encoding() const noexcept;
bool do_always_noconv() const noexcept;
int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
int do_max_length() const noexcept;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, bool& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned short& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned int& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, float& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, double& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long double& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, void*& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned short& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned int& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, float& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, double& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long double& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, void*& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, bool& val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, double val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long double val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, double val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;
State | stdio equivalent | |
floatfield == ios_base::fixed | %f | |
floatfield == ios_base::scientific && !uppercase | %e | |
floatfield == ios_base::scientific | %E | |
floatfield == (ios_base::fixed | ios_base::scientific) && !uppercase | %a | |
floatfield == (ios_base::fixed | ios_base::scientific) | %A | |
!uppercase | %g | |
otherwise | %G |
State | Location | |
adjustfield == ios_base::left | pad after | |
adjustfield == ios_base::right | pad before | |
adjustfield == internal and a sign occurs in the representation | pad after the sign | |
adjustfield == internal and representation after stage 1
began with 0x or 0X | pad after x or X | |
otherwise | pad before |
iter_type do_put(iter_type out, ios_base& str, char_type fill, bool val) const;
char_type decimal_point() const;
char_type thousands_sep() const;
string grouping() const;
string_type truename() const;
string_type falsename() const;
char_type do_decimal_point() const;
char_type do_thousands_sep() const;
string do_grouping() const;
string_type do_truename() const;
string_type do_falsename() const;
int compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const;
string_type transform(const charT* low, const charT* high) const;
long hash(const charT* low, const charT* high) const;
int do_compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const;
string_type do_transform(const charT* low, const charT* high) const;
long do_hash(const charT* low, const charT* high) const;
dateorder date_order() const;
iter_type get_time(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type get_date(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type get_year(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
tm* t, char format, char modifier = 0) const;
iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
tm* t, const char_type* fmt, const char_type* fmtend) const;
dateorder do_date_order() const;
iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type do_get_date(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type do_get_weekday(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type do_get_monthname(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type do_get_year(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type do_get(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t, char format, char modifier) const;
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
const charT* pattern, const charT* pat_end) const;
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
char format, char modifier = 0) const;
iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
char format, char modifier) const;
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
ios_base::iostate& err, long double& quant) const;
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
ios_base::iostate& err, string_type& quant) const;
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
ios_base::iostate& err, long double& units) const;
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
ios_base::iostate& err, string_type& digits) const;
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
iter_type do_put(iter_type s, bool intl, ios_base& str,
char_type fill, long double units) const;
iter_type do_put(iter_type s, bool intl, ios_base& str,
char_type fill, const string_type& digits) const;
charT do_decimal_point() const;
charT do_thousands_sep() const;
string do_grouping() const;
string_type do_curr_symbol() const;
string_type do_positive_sign() const;
string_type do_negative_sign() const;
int do_frac_digits() const;
pattern do_pos_format() const;
pattern do_neg_format() const;
catalog open(const string& name, const locale& loc) const;
string_type get(catalog cat, int set, int msgid, const string_type& dfault) const;
void close(catalog cat) const;
catalog do_open(const string& name, const locale& loc) const;
string_type do_get(catalog cat, int set, int msgid, const string_type& dfault) const;
void do_close(catalog cat) const;
fprintf | isprint | iswdigit | localeconv | tolower | |
fscanf | ispunct | iswgraph | mblen | toupper | |
isalnum | isspace | iswlower | mbstowcs | towlower | |
isalpha | isupper | iswprint | mbtowc | towupper | |
isblank | iswalnum | iswpunct | setlocale | wcscoll | |
iscntrl | iswalpha | iswspace | strcoll | wcstod | |
isdigit | iswblank | iswupper | strerror | wcstombs | |
isgraph | iswcntrl | iswxdigit | strtod | wcsxfrm | |
islower | iswctype | isxdigit | strxfrm | wctomb |
constexpr explicit text_encoding(string_view enc) noexcept;
constexpr text_encoding(id i) noexcept;
constexpr id mib() const noexcept;
constexpr const char* name() const noexcept;
constexpr aliases_view aliases() const noexcept;
static consteval text_encoding literal() noexcept;
static text_encoding environment();
template<id i>
static bool environment_is();
static constexpr bool comp-name(string_view a, string_view b);
friend constexpr bool operator==(const text_encoding& a, const text_encoding& b) noexcept;
friend constexpr bool operator==(const text_encoding& encoding, id i) noexcept;
template<> struct hash<text_encoding>;
Option | Meaning | |
< | ||
> | ||
^ | Forces the formatted argument to be centered within the field
by inserting
fill characters before and
fill characters after the formatted argument, where
n is the padding width. |
Option | Meaning | |
+ | ||
- | Indicates that a sign should be used for
negative numbers and negative zero only (this is the default behavior). | |
space | Indicates that a leading space should be used for
non-negative numbers other than negative zero, and
a minus sign for negative numbers and negative zero. |
Type | Meaning | |
none, s | Copies the string to the output. | |
? | Copies the escaped string ([format.string.escaped]) to the output. |
Type | Meaning | |
b | ||
B | ||
c | ||
d | to_chars(first, last, value). | |
o | ||
x | ||
X | ||
none |
Type | Meaning | |
none, c | Copies the character to the output. | |
b, B, d, o, x, X | ||
? | Copies the escaped character ([format.string.escaped]) to the output. |
Type | Meaning | |
a | If precision is specified, equivalent to
to_chars(first, last, value, chars_format::hex, precision)
where precision is the specified formatting precision; equivalent to
to_chars(first, last, value, chars_format::hex)
otherwise. | |
A | The same as a, except that
it uses uppercase letters for digits above 9 and
P to indicate the exponent. | |
e | Equivalent to
to_chars(first, last, value, chars_format::scientific, precision)
where precision is the specified formatting precision,
or 6 if precision is not specified. | |
E | ||
f, F | Equivalent to
to_chars(first, last, value, chars_format::fixed, precision)
where precision is the specified formatting precision,
or 6 if precision is not specified. | |
g | Equivalent to
to_chars(first, last, value, chars_format::general, precision)
where precision is the specified formatting precision,
or 6 if precision is not specified. | |
G | ||
none | If precision is specified, equivalent to
to_chars(first, last, value, chars_format::general, precision)
where precision is the specified formatting precision; equivalent to
to_chars(first, last, value)
otherwise. |
Type | Meaning | |
none, p | If uintptr_t is defined,
to_chars(first, last, reinterpret_cast<uintptr_t>(value), 16)
with the prefix 0x inserted immediately before the output of to_chars;
otherwise, implementation-defined. | |
P |
template<class T> consteval basic_format_string(const T& s);
template<class... Args>
string format(format_string<Args...> fmt, Args&&... args);
template<class... Args>
wstring format(wformat_string<Args...> fmt, Args&&... args);
template<class... Args>
string format(const locale& loc, format_string<Args...> fmt, Args&&... args);
template<class... Args>
wstring format(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
string vformat(string_view fmt, format_args args);
wstring vformat(wstring_view fmt, wformat_args args);
string vformat(const locale& loc, string_view fmt, format_args args);
wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
template<class Out, class... Args>
Out format_to(Out out, format_string<Args...> fmt, Args&&... args);
template<class Out, class... Args>
Out format_to(Out out, wformat_string<Args...> fmt, Args&&... args);
template<class Out, class... Args>
Out format_to(Out out, const locale& loc, format_string<Args...> fmt, Args&&... args);
template<class Out, class... Args>
Out format_to(Out out, const locale& loc, wformat_string<Args...> fmt, Args&&... args);
template<class Out>
Out vformat_to(Out out, string_view fmt, format_args args);
template<class Out>
Out vformat_to(Out out, wstring_view fmt, wformat_args args);
template<class Out>
Out vformat_to(Out out, const locale& loc, string_view fmt, format_args args);
template<class Out>
Out vformat_to(Out out, const locale& loc, wstring_view fmt, wformat_args args);
template<class Out, class... Args>
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
format_string<Args...> fmt, Args&&... args);
template<class Out, class... Args>
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
wformat_string<Args...> fmt, Args&&... args);
template<class Out, class... Args>
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
const locale& loc, format_string<Args...> fmt,
Args&&... args);
template<class Out, class... Args>
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
const locale& loc, wformat_string<Args...> fmt,
Args&&... args);
template<class... Args>
size_t formatted_size(format_string<Args...> fmt, Args&&... args);
template<class... Args>
size_t formatted_size(wformat_string<Args...> fmt, Args&&... args);
template<class... Args>
size_t formatted_size(const locale& loc, format_string<Args...> fmt, Args&&... args);
template<class... Args>
size_t formatted_size(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
Expression | Return type | Requirement | |
g.parse(pc) | PC::iterator | Parses format-spec ([format.string])
for type T
in the range [pc.begin(), pc.end())
until the first unmatched character.
Stores the parsed format specifiers in *this and
returns an iterator past the end of the parsed range. | |
f.format(u, fc) | FC::iterator | Formats u according to the specifiers stored in *this,
writes the output to fc.out(), and
returns an iterator past the end of the output range. The output shall only depend on
u,
fc.locale(),
fc.arg(n) for any value n of type size_t,
and the range [pc.begin(), pc.end())
from the last call to f.parse(pc). |
Expression | Return type | Requirement | |
f.format(t, fc) | FC::iterator | Formats t according to the specifiers stored in *this,
writes the output to fc.out(), and
returns an iterator past the end of the output range. The output shall only depend on
t,
fc.locale(),
fc.arg(n) for any value n of type size_t,
and the range [pc.begin(), pc.end())
from the last call to f.parse(pc). | |
f.format(u, fc) | FC::iterator | As above, but does not modify u. |
template<class T>
constexpr bool enable_nonlocking_formatter_optimization = false;