Skip to content

Commit bc01561

Browse files
authored
Merge 2022-07 LWG Motion 33
P2508R1 Expose std::basic-format-string<charT, Args...>
2 parents adf04f1 + 3c8ba25 commit bc01561

File tree

2 files changed

+61
-59
lines changed

2 files changed

+61
-59
lines changed

source/iostreams.tex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4168,9 +4168,9 @@
41684168

41694169
// \ref{ostream.formatted.print}, print functions
41704170
template<class... Args>
4171-
void print(ostream& os, @\exposid{format-string}@<Args...> fmt, Args&&... args);
4171+
void print(ostream& os, format_string<Args...> fmt, Args&&... args);
41724172
template<class... Args>
4173-
void println(ostream& os, @\exposid{format-string}@<Args...> fmt, Args&&... args);
4173+
void println(ostream& os, format_string<Args...> fmt, Args&&... args);
41744174

41754175
void vprint_unicode(ostream& os, string_view fmt, format_args args);
41764176
void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
@@ -4222,14 +4222,14 @@
42224222
namespace std {
42234223
// \ref{print.fun}, print functions
42244224
template<class... Args>
4225-
void print(@\exposid{format-string}@<Args...> fmt, Args&&... args);
4225+
void print(format_string<Args...> fmt, Args&&... args);
42264226
template<class... Args>
4227-
void print(FILE* stream, @\exposid{format-string}@<Args...> fmt, Args&&... args);
4227+
void print(FILE* stream, format_string<Args...> fmt, Args&&... args);
42284228

42294229
template<class... Args>
4230-
void println(@\exposid{format-string}@<Args...> fmt, Args&&... args);
4230+
void println(format_string<Args...> fmt, Args&&... args);
42314231
template<class... Args>
4232-
void println(FILE* stream, @\exposid{format-string}@<Args...> fmt, Args&&... args);
4232+
void println(FILE* stream, format_string<Args...> fmt, Args&&... args);
42334233

42344234
void vprint_unicode(string_view fmt, format_args args);
42354235
void vprint_unicode(FILE* stream, string_view fmt, format_args args);
@@ -6808,7 +6808,7 @@
68086808
\indexlibraryglobal{print}%
68096809
\begin{itemdecl}
68106810
template<class... Args>
6811-
void print(ostream& os, @\exposid{format-string}@<Args...> fmt, Args&&... args);
6811+
void print(ostream& os, format_string<Args...> fmt, Args&&... args);
68126812
\end{itemdecl}
68136813

68146814
\begin{itemdescr}
@@ -6827,7 +6827,7 @@
68276827
\indexlibraryglobal{println}%
68286828
\begin{itemdecl}
68296829
template<class... Args>
6830-
void println(ostream& os, @\exposid{format-string}@<Args...> fmt, Args&&... args);
6830+
void println(ostream& os, format_string<Args...> fmt, Args&&... args);
68316831
\end{itemdecl}
68326832

68336833
\begin{itemdescr}
@@ -7700,7 +7700,7 @@
77007700
\indexlibraryglobal{print}%
77017701
\begin{itemdecl}
77027702
template<class... Args>
7703-
void print(@\exposid{format-string}@<Args...> fmt, Args&&... args);
7703+
void print(format_string<Args...> fmt, Args&&... args);
77047704
\end{itemdecl}
77057705

77067706
\begin{itemdescr}
@@ -7715,7 +7715,7 @@
77157715
\indexlibraryglobal{print}%
77167716
\begin{itemdecl}
77177717
template<class... Args>
7718-
void print(FILE* stream, @\exposid{format-string}@<Args...> fmt, Args&&... args);
7718+
void print(FILE* stream, format_string<Args...> fmt, Args&&... args);
77197719
\end{itemdecl}
77207720

77217721
\begin{itemdescr}
@@ -7734,7 +7734,7 @@
77347734
\indexlibraryglobal{println}%
77357735
\begin{itemdecl}
77367736
template<class... Args>
7737-
void println(@\exposid{format-string}@<Args...> fmt, Args&&... args);
7737+
void println(format_string<Args...> fmt, Args&&... args);
77387738
\end{itemdecl}
77397739

77407740
\begin{itemdescr}
@@ -7749,7 +7749,7 @@
77497749
\indexlibraryglobal{println}%
77507750
\begin{itemdecl}
77517751
template<class... Args>
7752-
void println(FILE* stream, @\exposid{format-string}@<Args...> fmt, Args&&... args);
7752+
void println(FILE* stream, format_string<Args...> fmt, Args&&... args);
77537753
\end{itemdecl}
77547754

77557755
\begin{itemdescr}

source/utilities.tex

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13777,40 +13777,38 @@
1377713777
using format_args = basic_format_args<format_context>;
1377813778
using wformat_args = basic_format_args<wformat_context>;
1377913779

13780-
// \ref{format.fmt.string}, class template \exposid{basic-format-string}
13780+
// \ref{format.fmt.string}, class template \tcode{basic_format_string}
1378113781
template<class charT, class... Args>
13782-
struct @\exposid{basic-format-string}@; // \expos
13782+
struct basic_format_string;
1378313783

1378413784
template<class... Args>
13785-
using @\exposid{format-string}@ = // \expos
13786-
@\exposid{basic-format-string}@<char, type_identity_t<Args>...>;
13785+
using @\libglobal{format_string}@ = basic_format_string<char, type_identity_t<Args>...>;
1378713786
template<class... Args>
13788-
using @\exposid{wformat-string}@ = // \expos
13789-
@\exposid{basic-format-string}@<wchar_t, type_identity_t<Args>...>;
13787+
using @\libglobal{wformat_string}@ = basic_format_string<wchar_t, type_identity_t<Args>...>;
1379013788

1379113789
// \ref{format.functions}, formatting functions
1379213790
template<class... Args>
13793-
string format(@\exposid{format-string}@<Args...> fmt, Args&&... args);
13791+
string format(format_string<Args...> fmt, Args&&... args);
1379413792
template<class... Args>
13795-
wstring format(@\exposid{wformat-string}@<Args...> fmt, Args&&... args);
13793+
wstring format(wformat_string<Args...> fmt, Args&&... args);
1379613794
template<class... Args>
13797-
string format(const locale& loc, @\exposid{format-string}@<Args...> fmt, Args&&... args);
13795+
string format(const locale& loc, format_string<Args...> fmt, Args&&... args);
1379813796
template<class... Args>
13799-
wstring format(const locale& loc, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
13797+
wstring format(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
1380013798

1380113799
string vformat(string_view fmt, format_args args);
1380213800
wstring vformat(wstring_view fmt, wformat_args args);
1380313801
string vformat(const locale& loc, string_view fmt, format_args args);
1380413802
wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
1380513803

1380613804
template<class Out, class... Args>
13807-
Out format_to(Out out, @\exposid{format-string}@<Args...> fmt, Args&&... args);
13805+
Out format_to(Out out, format_string<Args...> fmt, Args&&... args);
1380813806
template<class Out, class... Args>
13809-
Out format_to(Out out, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
13807+
Out format_to(Out out, wformat_string<Args...> fmt, Args&&... args);
1381013808
template<class Out, class... Args>
13811-
Out format_to(Out out, const locale& loc, @\exposid{format-string}@<Args...> fmt, Args&&... args);
13809+
Out format_to(Out out, const locale& loc, format_string<Args...> fmt, Args&&... args);
1381213810
template<class Out, class... Args>
13813-
Out format_to(Out out, const locale& loc, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
13811+
Out format_to(Out out, const locale& loc, wformat_string<Args...> fmt, Args&&... args);
1381413812

1381513813
template<class Out>
1381613814
Out vformat_to(Out out, string_view fmt, format_args args);
@@ -13827,27 +13825,27 @@
1382713825
};
1382813826
template<class Out, class... Args>
1382913827
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
13830-
@\exposid{format-string}@<Args...> fmt, Args&&... args);
13828+
format_string<Args...> fmt, Args&&... args);
1383113829
template<class Out, class... Args>
1383213830
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
13833-
@\exposid{wformat-string}@<Args...> fmt, Args&&... args);
13831+
wformat_string<Args...> fmt, Args&&... args);
1383413832
template<class Out, class... Args>
1383513833
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
13836-
const locale& loc, @\exposid{format-string}@<Args...> fmt,
13834+
const locale& loc, format_string<Args...> fmt,
1383713835
Args&&... args);
1383813836
template<class Out, class... Args>
1383913837
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
13840-
const locale& loc, @\exposid{wformat-string}@<Args...> fmt,
13838+
const locale& loc, wformat_string<Args...> fmt,
1384113839
Args&&... args);
1384213840

1384313841
template<class... Args>
13844-
size_t formatted_size(@\exposid{format-string}@<Args...> fmt, Args&&... args);
13842+
size_t formatted_size(format_string<Args...> fmt, Args&&... args);
1384513843
template<class... Args>
13846-
size_t formatted_size(@\exposid{wformat-string}@<Args...> fmt, Args&&... args);
13844+
size_t formatted_size(wformat_string<Args...> fmt, Args&&... args);
1384713845
template<class... Args>
13848-
size_t formatted_size(const locale& loc, @\exposid{format-string}@<Args...> fmt, Args&&... args);
13846+
size_t formatted_size(const locale& loc, format_string<Args...> fmt, Args&&... args);
1384913847
template<class... Args>
13850-
size_t formatted_size(const locale& loc, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
13848+
size_t formatted_size(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
1385113849

1385213850
// \ref{format.formatter}, formatter
1385313851
template<class T, class charT = char> struct formatter;
@@ -14618,21 +14616,25 @@
1461814616
Failure to allocate storage is reported by
1461914617
throwing an exception as described in~\ref{res.on.exception.handling}.
1462014618

14621-
\rSec2[format.fmt.string]{Class template \exposid{basic-format-string}}
14619+
\rSec2[format.fmt.string]{Class template \tcode{basic_format_string}}
1462214620

1462314621
\begin{codeblock}
14624-
template<class charT, class... Args>
14625-
struct @\exposid{basic-format-string}@ { // \expos
14626-
private:
14627-
basic_string_view<charT> @\exposid{str}@; // \expos
14622+
namespace std {
14623+
template<class charT, class... Args>
14624+
struct @\libglobal{basic_format_string}@ {
14625+
private:
14626+
basic_string_view<charT> @\exposidnc{str}@; // \expos
1462814627

14629-
public:
14630-
template<class T> consteval @\exposid{basic-format-string}@(const T& s);
14631-
};
14628+
public:
14629+
template<class T> consteval basic_format_string(const T& s);
14630+
14631+
constexpr basic_string_view<charT> get() const noexcept { return @\exposid{str}@; }
14632+
};
14633+
}
1463214634
\end{codeblock}
1463314635

1463414636
\begin{itemdecl}
14635-
template<class T> consteval @\exposid{basic-format-string}@(const T& s);
14637+
template<class T> consteval basic_format_string(const T& s);
1463614638
\end{itemdecl}
1463714639

1463814640
\begin{itemdescr}
@@ -14662,7 +14664,7 @@
1466214664
\indexlibraryglobal{format}%
1466314665
\begin{itemdecl}
1466414666
template<class... Args>
14665-
string format(@\exposid{format-string}@<Args...> fmt, Args&&... args);
14667+
string format(format_string<Args...> fmt, Args&&... args);
1466614668
\end{itemdecl}
1466714669

1466814670
\begin{itemdescr}
@@ -14677,7 +14679,7 @@
1467714679
\indexlibraryglobal{format}%
1467814680
\begin{itemdecl}
1467914681
template<class... Args>
14680-
wstring format(@\exposid{wformat-string}@<Args...> fmt, Args&&... args);
14682+
wstring format(wformat_string<Args...> fmt, Args&&... args);
1468114683
\end{itemdecl}
1468214684

1468314685
\begin{itemdescr}
@@ -14692,7 +14694,7 @@
1469214694
\indexlibraryglobal{format}%
1469314695
\begin{itemdecl}
1469414696
template<class... Args>
14695-
string format(const locale& loc, @\exposid{format-string}@<Args...> fmt, Args&&... args);
14697+
string format(const locale& loc, format_string<Args...> fmt, Args&&... args);
1469614698
\end{itemdecl}
1469714699

1469814700
\begin{itemdescr}
@@ -14707,7 +14709,7 @@
1470714709
\indexlibraryglobal{format}%
1470814710
\begin{itemdecl}
1470914711
template<class... Args>
14710-
wstring format(const locale& loc, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
14712+
wstring format(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
1471114713
\end{itemdecl}
1471214714

1471314715
\begin{itemdescr}
@@ -14743,7 +14745,7 @@
1474314745
\indexlibraryglobal{format_to}%
1474414746
\begin{itemdecl}
1474514747
template<class Out, class... Args>
14746-
Out format_to(Out out, @\exposid{format-string}@<Args...> fmt, Args&&... args);
14748+
Out format_to(Out out, format_string<Args...> fmt, Args&&... args);
1474714749
\end{itemdecl}
1474814750

1474914751
\begin{itemdescr}
@@ -14758,7 +14760,7 @@
1475814760
\indexlibraryglobal{format_to}%
1475914761
\begin{itemdecl}
1476014762
template<class Out, class... Args>
14761-
Out format_to(Out out, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
14763+
Out format_to(Out out, wformat_string<Args...> fmt, Args&&... args);
1476214764
\end{itemdecl}
1476314765

1476414766
\begin{itemdescr}
@@ -14773,7 +14775,7 @@
1477314775
\indexlibraryglobal{format_to}%
1477414776
\begin{itemdecl}
1477514777
template<class Out, class... Args>
14776-
Out format_to(Out out, const locale& loc, @\exposid{format-string}@<Args...> fmt, Args&&... args);
14778+
Out format_to(Out out, const locale& loc, format_string<Args...> fmt, Args&&... args);
1477714779
\end{itemdecl}
1477814780

1477914781
\begin{itemdescr}
@@ -14788,7 +14790,7 @@
1478814790
\indexlibraryglobal{format_to}%
1478914791
\begin{itemdecl}
1479014792
template<class Out, class... Args>
14791-
Out format_to(Out out, const locale& loc, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
14793+
Out format_to(Out out, const locale& loc, wformat_string<Args...> fmt, Args&&... args);
1479214794
\end{itemdecl}
1479314795

1479414796
\begin{itemdescr}
@@ -14846,17 +14848,17 @@
1484614848
\begin{itemdecl}
1484714849
template<class Out, class... Args>
1484814850
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
14849-
@\exposid{format-string}@<Args...> fmt, Args&&... args);
14851+
format_string<Args...> fmt, Args&&... args);
1485014852
template<class Out, class... Args>
1485114853
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
14852-
@\exposid{wformat-string}@<Args...> fmt, Args&&... args);
14854+
wformat_string<Args...> fmt, Args&&... args);
1485314855
template<class Out, class... Args>
1485414856
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
14855-
const locale& loc, @\exposid{format-string}@<Args...> fmt,
14857+
const locale& loc, format_string<Args...> fmt,
1485614858
Args&&... args);
1485714859
template<class Out, class... Args>
1485814860
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
14859-
const locale& loc, @\exposid{wformat-string}@<Args...> fmt,
14861+
const locale& loc, wformat_string<Args...> fmt,
1486014862
Args&&... args);
1486114863
\end{itemdecl}
1486214864

@@ -14902,13 +14904,13 @@
1490214904
\indexlibraryglobal{formatted_size}%
1490314905
\begin{itemdecl}
1490414906
template<class... Args>
14905-
size_t formatted_size(@\exposid{format-string}@<Args...> fmt, Args&&... args);
14907+
size_t formatted_size(format_string<Args...> fmt, Args&&... args);
1490614908
template<class... Args>
14907-
size_t formatted_size(@\exposid{wformat-string}@<Args...> fmt, Args&&... args);
14909+
size_t formatted_size(wformat_string<Args...> fmt, Args&&... args);
1490814910
template<class... Args>
14909-
size_t formatted_size(const locale& loc, @\exposid{format-string}@<Args...> fmt, Args&&... args);
14911+
size_t formatted_size(const locale& loc, format_string<Args...> fmt, Args&&... args);
1491014912
template<class... Args>
14911-
size_t formatted_size(const locale& loc, @\exposid{wformat-string}@<Args...> fmt, Args&&... args);
14913+
size_t formatted_size(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
1491214914
\end{itemdecl}
1491314915

1491414916
\begin{itemdescr}

0 commit comments

Comments
 (0)