From dcef4d07bb93d48d973f26985b4452bb22935f63 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Fri, 29 Jul 2022 19:28:12 +0200 Subject: [PATCH 1/2] P2508R1 Expose std::basic-format-string The feature test macros will be revised after all motions have been applied. --- source/utilities.tex | 96 ++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index e78ed9dc4a..d39d832c75 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -13777,26 +13777,24 @@ using format_args = basic_format_args; using wformat_args = basic_format_args; - // \ref{format.fmt.string}, class template \exposid{basic-format-string} + // \ref{format.fmt.string}, class template \tcode{basic_format_string} template - struct @\exposid{basic-format-string}@; // \expos + struct basic_format_string; template - using @\exposid{format-string}@ = // \expos - @\exposid{basic-format-string}@...>; + using @\libglobal{format_string}@ = basic_format_string...>; template - using @\exposid{wformat-string}@ = // \expos - @\exposid{basic-format-string}@...>; + using @\libglobal{wformat_string}@ = basic_format_string...>; // \ref{format.functions}, formatting functions template - string format(@\exposid{format-string}@ fmt, Args&&... args); + string format(format_string fmt, Args&&... args); template - wstring format(@\exposid{wformat-string}@ fmt, Args&&... args); + wstring format(wformat_string fmt, Args&&... args); template - string format(const locale& loc, @\exposid{format-string}@ fmt, Args&&... args); + string format(const locale& loc, format_string fmt, Args&&... args); template - wstring format(const locale& loc, @\exposid{wformat-string}@ fmt, Args&&... args); + 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); @@ -13804,13 +13802,13 @@ wstring vformat(const locale& loc, wstring_view fmt, wformat_args args); template - Out format_to(Out out, @\exposid{format-string}@ fmt, Args&&... args); + Out format_to(Out out, format_string fmt, Args&&... args); template - Out format_to(Out out, @\exposid{wformat-string}@ fmt, Args&&... args); + Out format_to(Out out, wformat_string fmt, Args&&... args); template - Out format_to(Out out, const locale& loc, @\exposid{format-string}@ fmt, Args&&... args); + Out format_to(Out out, const locale& loc, format_string fmt, Args&&... args); template - Out format_to(Out out, const locale& loc, @\exposid{wformat-string}@ fmt, Args&&... args); + 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); @@ -13827,27 +13825,27 @@ }; template format_to_n_result format_to_n(Out out, iter_difference_t n, - @\exposid{format-string}@ fmt, Args&&... args); + format_string fmt, Args&&... args); template format_to_n_result format_to_n(Out out, iter_difference_t n, - @\exposid{wformat-string}@ fmt, Args&&... args); + wformat_string fmt, Args&&... args); template format_to_n_result format_to_n(Out out, iter_difference_t n, - const locale& loc, @\exposid{format-string}@ fmt, + 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, @\exposid{wformat-string}@ fmt, + const locale& loc, wformat_string fmt, Args&&... args); template - size_t formatted_size(@\exposid{format-string}@ fmt, Args&&... args); + size_t formatted_size(format_string fmt, Args&&... args); template - size_t formatted_size(@\exposid{wformat-string}@ fmt, Args&&... args); + size_t formatted_size(wformat_string fmt, Args&&... args); template - size_t formatted_size(const locale& loc, @\exposid{format-string}@ fmt, Args&&... args); + size_t formatted_size(const locale& loc, format_string fmt, Args&&... args); template - size_t formatted_size(const locale& loc, @\exposid{wformat-string}@ fmt, Args&&... args); + size_t formatted_size(const locale& loc, wformat_string fmt, Args&&... args); // \ref{format.formatter}, formatter template struct formatter; @@ -14618,21 +14616,25 @@ Failure to allocate storage is reported by throwing an exception as described in~\ref{res.on.exception.handling}. -\rSec2[format.fmt.string]{Class template \exposid{basic-format-string}} +\rSec2[format.fmt.string]{Class template \tcode{basic_format_string}} \begin{codeblock} -template -struct @\exposid{basic-format-string}@ { // \expos -private: - basic_string_view @\exposid{str}@; // \expos +namespace std { + template + struct @\libglobal{basic_format_string}@ { + private: + basic_string_view @\exposidnc{str}@; // \expos -public: - template consteval @\exposid{basic-format-string}@(const T& s); -}; + public: + template consteval basic_format_string(const T& s); + + constexpr basic_string_view get() const noexcept { return @\exposid{str}@; } + }; +} \end{codeblock} \begin{itemdecl} -template consteval @\exposid{basic-format-string}@(const T& s); +template consteval basic_format_string(const T& s); \end{itemdecl} \begin{itemdescr} @@ -14662,7 +14664,7 @@ \indexlibraryglobal{format}% \begin{itemdecl} template - string format(@\exposid{format-string}@ fmt, Args&&... args); + string format(format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14677,7 +14679,7 @@ \indexlibraryglobal{format}% \begin{itemdecl} template - wstring format(@\exposid{wformat-string}@ fmt, Args&&... args); + wstring format(wformat_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14692,7 +14694,7 @@ \indexlibraryglobal{format}% \begin{itemdecl} template - string format(const locale& loc, @\exposid{format-string}@ fmt, Args&&... args); + string format(const locale& loc, format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14707,7 +14709,7 @@ \indexlibraryglobal{format}% \begin{itemdecl} template - wstring format(const locale& loc, @\exposid{wformat-string}@ fmt, Args&&... args); + wstring format(const locale& loc, wformat_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14743,7 +14745,7 @@ \indexlibraryglobal{format_to}% \begin{itemdecl} template - Out format_to(Out out, @\exposid{format-string}@ fmt, Args&&... args); + Out format_to(Out out, format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14758,7 +14760,7 @@ \indexlibraryglobal{format_to}% \begin{itemdecl} template - Out format_to(Out out, @\exposid{wformat-string}@ fmt, Args&&... args); + Out format_to(Out out, wformat_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14773,7 +14775,7 @@ \indexlibraryglobal{format_to}% \begin{itemdecl} template - Out format_to(Out out, const locale& loc, @\exposid{format-string}@ fmt, Args&&... args); + Out format_to(Out out, const locale& loc, format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14788,7 +14790,7 @@ \indexlibraryglobal{format_to}% \begin{itemdecl} template - Out format_to(Out out, const locale& loc, @\exposid{wformat-string}@ fmt, Args&&... args); + Out format_to(Out out, const locale& loc, wformat_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -14846,17 +14848,17 @@ \begin{itemdecl} template format_to_n_result format_to_n(Out out, iter_difference_t n, - @\exposid{format-string}@ fmt, Args&&... args); + format_string fmt, Args&&... args); template format_to_n_result format_to_n(Out out, iter_difference_t n, - @\exposid{wformat-string}@ fmt, Args&&... args); + wformat_string fmt, Args&&... args); template format_to_n_result format_to_n(Out out, iter_difference_t n, - const locale& loc, @\exposid{format-string}@ fmt, + 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, @\exposid{wformat-string}@ fmt, + const locale& loc, wformat_string fmt, Args&&... args); \end{itemdecl} @@ -14902,13 +14904,13 @@ \indexlibraryglobal{formatted_size}% \begin{itemdecl} template - size_t formatted_size(@\exposid{format-string}@ fmt, Args&&... args); + size_t formatted_size(format_string fmt, Args&&... args); template - size_t formatted_size(@\exposid{wformat-string}@ fmt, Args&&... args); + size_t formatted_size(wformat_string fmt, Args&&... args); template - size_t formatted_size(const locale& loc, @\exposid{format-string}@ fmt, Args&&... args); + size_t formatted_size(const locale& loc, format_string fmt, Args&&... args); template - size_t formatted_size(const locale& loc, @\exposid{wformat-string}@ fmt, Args&&... args); + size_t formatted_size(const locale& loc, wformat_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} From 3c8ba258c3a26fd880ffb87064bfdf4120d92c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Thu, 18 Aug 2022 00:04:55 +0100 Subject: [PATCH 2/2] [input.output] Change exposition-only format-string to format_string These exposition-only names were added by LWG Motion-11 P2093R14 ("Formatted output") and need to be updated. --- source/iostreams.tex | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/iostreams.tex b/source/iostreams.tex index ee3afe522c..c0bb5aee0b 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -4168,9 +4168,9 @@ // \ref{ostream.formatted.print}, print functions template - void print(ostream& os, @\exposid{format-string}@ fmt, Args&&... args); + void print(ostream& os, format_string fmt, Args&&... args); template - void println(ostream& os, @\exposid{format-string}@ fmt, Args&&... args); + void println(ostream& os, format_string fmt, Args&&... args); void vprint_unicode(ostream& os, string_view fmt, format_args args); void vprint_nonunicode(ostream& os, string_view fmt, format_args args); @@ -4222,14 +4222,14 @@ namespace std { // \ref{print.fun}, print functions template - void print(@\exposid{format-string}@ fmt, Args&&... args); + void print(format_string fmt, Args&&... args); template - void print(FILE* stream, @\exposid{format-string}@ fmt, Args&&... args); + void print(FILE* stream, format_string fmt, Args&&... args); template - void println(@\exposid{format-string}@ fmt, Args&&... args); + void println(format_string fmt, Args&&... args); template - void println(FILE* stream, @\exposid{format-string}@ fmt, Args&&... args); + void println(FILE* stream, format_string fmt, Args&&... args); void vprint_unicode(string_view fmt, format_args args); void vprint_unicode(FILE* stream, string_view fmt, format_args args); @@ -6808,7 +6808,7 @@ \indexlibraryglobal{print}% \begin{itemdecl} template - void print(ostream& os, @\exposid{format-string}@ fmt, Args&&... args); + void print(ostream& os, format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -6827,7 +6827,7 @@ \indexlibraryglobal{println}% \begin{itemdecl} template - void println(ostream& os, @\exposid{format-string}@ fmt, Args&&... args); + void println(ostream& os, format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -7700,7 +7700,7 @@ \indexlibraryglobal{print}% \begin{itemdecl} template - void print(@\exposid{format-string}@ fmt, Args&&... args); + void print(format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -7715,7 +7715,7 @@ \indexlibraryglobal{print}% \begin{itemdecl} template - void print(FILE* stream, @\exposid{format-string}@ fmt, Args&&... args); + void print(FILE* stream, format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -7734,7 +7734,7 @@ \indexlibraryglobal{println}% \begin{itemdecl} template - void println(@\exposid{format-string}@ fmt, Args&&... args); + void println(format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr} @@ -7749,7 +7749,7 @@ \indexlibraryglobal{println}% \begin{itemdecl} template - void println(FILE* stream, @\exposid{format-string}@ fmt, Args&&... args); + void println(FILE* stream, format_string fmt, Args&&... args); \end{itemdecl} \begin{itemdescr}