|
| 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<class T> |
| 20 | + concept <i>integral-constant-like</i> = <i>// exposition only</i> |
| 21 | + is_integral_v<<ins>remove_cvref_t<</ins>decltype(T::value)<ins>></ins>> && |
| 22 | + !is_same_v<bool, remove_const_t<decltype(T::value)>> && |
| 23 | + convertible_to<T, decltype(T::value)> && |
| 24 | + equality_comparable_with<T, decltype(T::value)> && |
| 25 | + bool_constant<T() == T::value>::value && |
| 26 | + bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value; |
| 27 | +</pre> |
| 28 | +</blockquote> |
| 29 | +<p> |
| 30 | +This was done so that <code>constant_wrapper<int></code> models the concept, |
| 31 | +but it needs an additional tweak so that |
| 32 | +<code>constant_wrapper<bool&></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<class T> |
| 48 | + concept <i>integral-constant-like</i> = <i>// exposition only</i> |
| 49 | + is_integral_v<remove_cvref_t<decltype(T::value)>> && |
| 50 | + !is_same_v<bool, remove_<ins>cvref</ins><del>const</del>_t<decltype(T::value)>> && |
| 51 | + convertible_to<T, decltype(T::value)> && |
| 52 | + equality_comparable_with<T, decltype(T::value)> && |
| 53 | + bool_constant<T() == T::value>::value && |
| 54 | + bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value; |
| 55 | +</pre> |
| 56 | +</blockquote> |
| 57 | +</li> |
| 58 | +</ol> |
| 59 | + |
| 60 | +</resolution> |
| 61 | + |
| 62 | +</issue> |
0 commit comments