Skip to content

Commit b8447a9

Browse files
committed
New issue from Tomasz: "enable_nonlocking_formatter_optimization for pair and tuple needs remove_cvref_t"
1 parent b7b31c7 commit b8447a9

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

xml/issue4399.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4399" status="New">
5+
<title>`enable_nonlocking_formatter_optimization` for `pair` and `tuple` needs `remove_cvref_t`</title>
6+
<section><sref ref="[format.tuple]"/></section>
7+
<submitter>Tomasz Kamiński</submitter>
8+
<date>02 Oct 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
The `enable_nonlocking_formatter_optimization` variable template is specialized only for <i>cv</i>-unqualified
14+
types. However, the specialization for `pair` and `tuple` does not remove the references and
15+
<i>cv</i>-qualifiers from the elements:
16+
</p>
17+
<blockquote><pre>
18+
template&lt;class... Ts&gt;
19+
constexpr bool enable_nonlocking_formatter_optimization&lt;<i>pair-or-tuple</i>&lt;Ts...&gt;&gt; =
20+
(enable_nonlocking_formatter_optimization&lt;Ts&gt; &amp;&amp; ...);
21+
</pre></blockquote>
22+
<p>
23+
As consequence <tt>pair&lt;const std::string, int&gt;</tt> or
24+
<tt>pair&lt;const std::string&amp;, int&amp;&gt;</tt> (`map` and `flat_map` reference types)
25+
will not use unbuffered prints.
26+
</p>
27+
</discussion>
28+
29+
<resolution>
30+
<p>
31+
This wording is relative to <paper num="N5014"/>.
32+
</p>
33+
34+
<ol>
35+
36+
<li><p>Modify <sref ref="[format.tuple]"/> as indicated:</p>
37+
38+
<blockquote>
39+
<p>
40+
-1- For each of `pair` and `tuple`, the library provides the following formatter specialization
41+
where <tt><i>pair-or-tuple</i></tt> is the name of the template:
42+
</p>
43+
<blockquote>
44+
<pre>
45+
namespace std {
46+
[&hellip;]
47+
48+
template&lt;class... Ts&gt;
49+
constexpr bool enable_nonlocking_formatter_optimization&lt;<i>pair-or-tuple</i>&lt;Ts...&gt;&gt; =
50+
(enable_nonlocking_formatter_optimization&lt;<ins>remove_cvref_t&lt;</ins>Ts<ins>&gt;</ins>&gt; &amp;&amp; ...);
51+
}
52+
</pre>
53+
</blockquote>
54+
</blockquote>
55+
</li>
56+
</ol>
57+
58+
</resolution>
59+
60+
</issue>

0 commit comments

Comments
 (0)