Skip to content

Commit aa7c593

Browse files
committed
New issue from Jonathan: integral-constant-like needs more remove_cvref_t
1 parent e1cb027 commit aa7c593

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

xml/issue4351.xml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4351" status="New">
5+
<title><code><i>integral-constant-like</i></code> needs more `remove_cvref_t`</title>
6+
<section><sref ref="[span.syn]"/></section>
7+
<submitter>Jonathan Wakely</submitter>
8+
<date>05 Sep 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
<paper num="P2781R9"/> tweaked the definition of
14+
<code><i>integral-constant-like</i></code> to work with `constant_wrapper`,
15+
like so:
16+
</p>
17+
<blockquote>
18+
<pre>
19+
template&lt;class T&gt;
20+
concept <i>integral-constant-like</i> = <i>// exposition only</i>
21+
is_integral_v&lt;<ins>remove_cvref_t&lt;</ins>decltype(T::value)<ins>&gt;</ins>&gt; &amp;&amp;
22+
!is_same_v&lt;bool, remove_const_t&lt;decltype(T::value)&gt;&gt; &amp;&amp;
23+
convertible_to&lt;T, decltype(T::value)&gt; &amp;&amp;
24+
equality_comparable_with&lt;T, decltype(T::value)&gt; &amp;&amp;
25+
bool_constant&lt;T() == T::value&gt;::value &amp;&amp;
26+
bool_constant&lt;static_cast&lt;decltype(T::value)&gt;(T()) == T::value&gt;::value;
27+
</pre>
28+
</blockquote>
29+
<p>
30+
This was done so that <code>constant_wrapper&lt;int&gt;</code> models the concept,
31+
but it needs an additional tweak so that
32+
<code>constant_wrapper&lt;bool&amp;&gt;</code> does not model it.
33+
</p>
34+
</discussion>
35+
36+
<resolution>
37+
<p>
38+
This wording is relative to <paper num="N5014"/>.
39+
</p>
40+
41+
<ol>
42+
43+
<li><p>Modify <sref ref="[span.syn]"/> as indicated:</p>
44+
45+
<blockquote>
46+
<pre>
47+
template&lt;class T&gt;
48+
concept <i>integral-constant-like</i> = <i>// exposition only</i>
49+
is_integral_v&lt;remove_cvref_t&lt;decltype(T::value)&gt;&gt; &amp;&amp;
50+
!is_same_v&lt;bool, remove_<ins>cvref</ins><del>const</del>_t&lt;decltype(T::value)&gt;&gt; &amp;&amp;
51+
convertible_to&lt;T, decltype(T::value)&gt; &amp;&amp;
52+
equality_comparable_with&lt;T, decltype(T::value)&gt; &amp;&amp;
53+
bool_constant&lt;T() == T::value&gt;::value &amp;&amp;
54+
bool_constant&lt;static_cast&lt;decltype(T::value)&gt;(T()) == T::value&gt;::value;
55+
</pre>
56+
</blockquote>
57+
</li>
58+
</ol>
59+
60+
</resolution>
61+
62+
</issue>

0 commit comments

Comments
 (0)