Skip to content

Commit 126d245

Browse files
jensmaurertkoeppe
authored andcommitted
P2418R2 Add support for std::generator-like types to std::format
1 parent 26b371e commit 126d245

File tree

2 files changed

+119
-61
lines changed

2 files changed

+119
-61
lines changed

source/compatibility.tex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@
7676
// previously threw \tcode{format_error}
7777
\end{codeblock}
7878

79+
\diffref{format}
80+
\change
81+
Signature changes: \tcode{format}, \tcode{format_to}, \tcode{format_to_n},
82+
\tcode{formatted_size}.
83+
\rationale
84+
Enable formatting of views that are neither const-iterable nor copyable.
85+
\effect
86+
Valid \CppXX{} code that passes bit fields to formatting functions
87+
may become ill-formed. For example:
88+
\begin{codeblock}
89+
struct tiny {
90+
int bit: 1;
91+
};
92+
93+
auto t = tiny();
94+
std::format("{}", t.bit); // ill-formed, previously returned \tcode{"0"}
95+
\end{codeblock}
96+
7997
\rSec1[diff.cpp17]{\Cpp{} and ISO \CppXVII{}}
8098

8199
\rSec2[diff.cpp17.general]{General}

0 commit comments

Comments
 (0)