[format.syn] # 28 Text processing library [[text]](./#text) ## 28.5 Formatting [[format]](format#syn) ### 28.5.1 Header synopsis [format.syn] [🔗](#header:%3cformat%3e) namespace std {// [[format.context]](format.context "28.5.6.7 Class template basic_­format_­context"), class template basic_format_contexttemplate class basic_format_context; using format_context = basic_format_context<*unspecified*, char>; using wformat_context = basic_format_context<*unspecified*, wchar_t>; // [[format.args]](format.args "28.5.8.3 Class template basic_­format_­args"), class template basic_format_argstemplate class basic_format_args; using format_args = basic_format_args; using wformat_args = basic_format_args; // [[format.fmt.string]](format.fmt.string "28.5.4 Class template basic_­format_­string"), class template basic_format_stringtemplatestruct basic_format_string; template struct *runtime-format-string* { // *exposition only*private: basic_string_view *str*; // *exposition only*public:*runtime-format-string*(basic_string_view s) noexcept : *str*(s) {}*runtime-format-string*(const *runtime-format-string*&) = delete; *runtime-format-string*& operator=(const *runtime-format-string*&) = delete; }; *runtime-format-string* runtime_format(string_view fmt) noexcept { return fmt; }*runtime-format-string* runtime_format(wstring_view fmt) noexcept { return fmt; }templateusing [format_string](#lib:format_string "28.5.1 Header synopsis [format.syn]") = basic_format_string...>; templateusing [wformat_string](#lib:wformat_string "28.5.1 Header synopsis [format.syn]") = basic_format_string...>; // [[format.functions]](format.functions "28.5.5 Formatting functions"), formatting functionstemplate string format(format_string fmt, Args&&... args); template wstring format(wformat_string fmt, Args&&... args); template string format(const locale& loc, format_string fmt, Args&&... args); template wstring format(const locale& loc, wformat_string 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 Out format_to(Out out, format_string fmt, Args&&... args); template Out format_to(Out out, wformat_string fmt, Args&&... args); template Out format_to(Out out, const locale& loc, format_string fmt, Args&&... args); template Out format_to(Out out, const locale& loc, wformat_string fmt, Args&&... args); template Out vformat_to(Out out, string_view fmt, format_args args); template Out vformat_to(Out out, wstring_view fmt, wformat_args args); template Out vformat_to(Out out, const locale& loc, string_view fmt, format_args args); template Out vformat_to(Out out, const locale& loc, wstring_view fmt, wformat_args args); template struct format_to_n_result { Out out; iter_difference_t size; }; template format_to_n_result format_to_n(Out out, iter_difference_t n, format_string fmt, Args&&... args); template format_to_n_result format_to_n(Out out, iter_difference_t n, wformat_string fmt, Args&&... args); template format_to_n_result format_to_n(Out out, iter_difference_t n, const locale& loc, format_string fmt, Args&&... args); template format_to_n_result format_to_n(Out out, iter_difference_t n, const locale& loc, wformat_string fmt, Args&&... args); template size_t formatted_size(format_string fmt, Args&&... args); template size_t formatted_size(wformat_string fmt, Args&&... args); template size_t formatted_size(const locale& loc, format_string fmt, Args&&... args); template size_t formatted_size(const locale& loc, wformat_string fmt, Args&&... args); // [[format.formatter]](format.formatter "28.5.6 Formatter"), formattertemplate struct formatter; // [[format.formatter.locking]](format.formatter.locking "28.5.6.2 Formatter locking"), formatter lockingtemplateconstexpr bool enable_nonlocking_formatter_optimization = false; // [[format.formattable]](format.formattable "28.5.6.3 Concept formattable"), concept [formattable](format.formattable#concept:formattable "28.5.6.3 Concept formattable [format.formattable]")templateconcept formattable = *see below*; templateconcept [*const-formattable-range*](#concept:const-formattable-range "28.5.1 Header synopsis [format.syn]") = // *exposition only* ranges::[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") &&[formattable](format.formattable#concept:formattable "28.5.6.3 Concept formattable [format.formattable]"), charT>; templateusing *fmt-maybe-const* = // *exposition only* conditional_t<[*const-formattable-range*](#concept:const-formattable-range "28.5.1 Header synopsis [format.syn]"), const R, R>; // [[format.parse.ctx]](format.parse.ctx "28.5.6.6 Class template basic_­format_­parse_­context"), class template basic_format_parse_contexttemplate class basic_format_parse_context; using format_parse_context = basic_format_parse_context; using wformat_parse_context = basic_format_parse_context; // [[format.range]](format.range "28.5.7 Formatting of ranges"), formatting of ranges// [[format.range.fmtkind]](format.range.fmtkind "28.5.7.1 Variable template format_­kind"), variable template format_kindenum class [range_format](#lib:range_format "28.5.1 Header synopsis [format.syn]") {[disabled](#lib:range_format,disabled "28.5.1 Header synopsis [format.syn]"), [map](#lib:range_format,map "28.5.1 Header synopsis [format.syn]"), [set](#lib:range_format,set "28.5.1 Header synopsis [format.syn]"), [sequence](#lib:range_format,sequence "28.5.1 Header synopsis [format.syn]"), [string](#lib:range_format,string "28.5.1 Header synopsis [format.syn]"), [debug_string](#lib:range_format,debug_string "28.5.1 Header synopsis [format.syn]")}; templateconstexpr *unspecified* format_kind = *unspecified*; templaterequires [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")>constexpr range_format format_kind = *see below*; // [[format.range.formatter]](format.range.formatter "28.5.7.2 Class template range_­formatter"), class template range_formattertemplaterequires [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]"), T> && [formattable](format.formattable#concept:formattable "28.5.6.3 Concept formattable [format.formattable]")class range_formatter; // [[format.range.fmtdef]](format.range.fmtdef "28.5.7.3 Class template range-default-formatter"), class template *range-default-formatter*templatestruct *range-default-formatter*; // *exposition only*// [[format.range.fmtmap]](format.range.fmtmap "28.5.7.4 Specialization of range-default-formatter for maps"), [[format.range.fmtset]](format.range.fmtset "28.5.7.5 Specialization of range-default-formatter for sets"), [[format.range.fmtstr]](format.range.fmtstr "28.5.7.6 Specialization of range-default-formatter for strings"), specializations for maps, sets, and stringstemplaterequires (format_kind != range_format::disabled) &&[formattable](format.formattable#concept:formattable "28.5.6.3 Concept formattable [format.formattable]"), charT>struct formatter : *range-default-formatter*, R, charT> { }; templaterequires (format_kind != range_format::disabled)constexpr bool enable_nonlocking_formatter_optimization = false; // [[format.arguments]](format.arguments "28.5.8 Arguments"), arguments// [[format.arg]](format.arg "28.5.8.1 Class template basic_­format_­arg"), class template basic_format_argtemplate class basic_format_arg; // [[format.arg.store]](format.arg.store "28.5.8.2 Class template format-arg-store"), class template *format-arg-store*template class *format-arg-store*; // *exposition only*template*format-arg-store* make_format_args(Args&... fmt_args); template*format-arg-store* make_wformat_args(Args&... args); // [[format.error]](format.error "28.5.10 Class format_­error"), class format_errorclass format_error;} [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L5906) The class template format_to_n_result has the template parameters, data members, and special members specified above[.](#1.sentence-1) It has no base classes or members other than those specified[.](#1.sentence-2)