Skip to content

Commit 8a0d6cf

Browse files
tzlainejwakely
authored andcommitted
Update PR for 4383.
1 parent 21bb709 commit 8a0d6cf

File tree

1 file changed

+119
-1
lines changed

1 file changed

+119
-1
lines changed

xml/issue4383.xml

Lines changed: 119 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,129 @@ struct <i>cw-operators</i> {
142142
</ol>
143143
</superseded>
144144

145-
<note>2025-11-04; Zach provides improved wording</note>
145+
<note>2025-11-05; Zach provides improved wording</note>
146146

147147
</discussion>
148148

149149
<resolution>
150+
<p>
151+
This wording is relative to <paper num="N5014"/>.
152+
</p>
153+
154+
<ol>
155+
156+
<li><p>Modify <sref ref="[const.wrap.class]"/>, class template <tt>constant_wrapper</tt> synopsis, as indicated:</p>
157+
158+
<blockquote class="note">
159+
<p>
160+
[<i>Drafting note:</i> The requires clause follows the form of `constant_wrapper`'s
161+
function call operator.]
162+
</p>
163+
</blockquote>
164+
165+
<blockquote>
166+
<pre>
167+
struct <i>cw-operators</i> { // <i>exposition only</i>
168+
[&hellip;]
169+
// <i>pseudo-mutators</i>
170+
<del>template&lt;<i>constexpr-param</i> T&gt;
171+
constexpr auto operator++(this T) noexcept requires requires(T::value_type x) { ++x; }
172+
{ return constant_wrapper&lt;[] { auto c = T::value; return ++c; }()&gt;{}; }
173+
template&lt;<i>constexpr-param</i> T&gt;
174+
constexpr auto operator++(this T, int) noexcept requires requires(T::value_type x) { x++; }
175+
{ return constant_wrapper&lt;[] { auto c = T::value; return c++; }()&gt;{}; }
176+
177+
template&lt;<i>constexpr-param</i> T&gt;
178+
constexpr auto operator--(this T) noexcept requires requires(T::value_type x) { --x; }
179+
{ return constant_wrapper&lt;[] { auto c = T::value; return --c; }()&gt;{}; }
180+
template&lt;<i>constexpr-param</i> T&gt;
181+
constexpr auto operator--(this T, int) noexcept requires requires(T::value_type x) { x--; }
182+
{ return constant_wrapper&lt;[] { auto c = T::value; return c--; }()&gt;{}; }
183+
184+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
185+
constexpr auto operator+=(this T, R) noexcept requires requires(T::value_type x) { x += R::value; }
186+
{ return constant_wrapper&lt;[] { auto v = T::value; return v += R::value; }()&gt;{}; }
187+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
188+
constexpr auto operator-=(this T, R) noexcept requires requires(T::value_type x) { x -= R::value; }
189+
{ return constant_wrapper&lt;[] { auto v = T::value; return v -= R::value; }()&gt;{}; }
190+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
191+
constexpr auto operator*=(this T, R) noexcept requires requires(T::value_type x) { x *= R::value; }
192+
{ return constant_wrapper&lt;[] { auto v = T::value; return v *= R::value; }()&gt;{}; }
193+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
194+
constexpr auto operator/=(this T, R) noexcept requires requires(T::value_type x) { x /= R::value; }
195+
{ return constant_wrapper&lt;[] { auto v = T::value; return v /= R::value; }()&gt;{}; }
196+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
197+
constexpr auto operator%=(this T, R) noexcept requires requires(T::value_type x) { x %= R::value; }
198+
{ return constant_wrapper&lt;[] { auto v = T::value; return v %= R::value; }()&gt;{}; }
199+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
200+
constexpr auto operator&amp;=(this T, R) noexcept requires requires(T::value_type x) { x &amp;= R::value; }
201+
{ return constant_wrapper&lt;[] { auto v = T::value; return v &amp;= R::value; }()&gt;{}; }
202+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
203+
constexpr auto operator|=(this T, R) noexcept requires requires(T::value_type x) { x |= R::value; }
204+
{ return constant_wrapper&lt;[] { auto v = T::value; return v |= R::value; }()&gt;{}; }
205+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
206+
constexpr auto operator^=(this T, R) noexcept requires requires(T::value_type x) { x ^= R::value; }
207+
{ return constant_wrapper&lt;[] { auto v = T::value; return v ^= R::value; }()&gt;{}; }
208+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
209+
constexpr auto operator&lt;&lt;=(this T, R) noexcept requires requires(T::value_type x) { x &lt;&lt;= R::value; }
210+
{ return constant_wrapper&lt;[] { auto v = T::value; return v &lt;&lt;= R::value; }()&gt;{}; }
211+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
212+
constexpr auto operator&gt;&gt;=(this T, R) noexcept requires requires(T::value_type x) { x &gt;&gt;= R::value; }
213+
{ return constant_wrapper&lt;[] { auto v = T::value; return v &gt;&gt;= R::value; }()&gt;{}; }</del>
214+
<ins>template&lt;<i>constexpr-param</i> T&gt;
215+
constexpr auto operator++(this T) noexcept -&gt; constant_wrapper&lt;++Y&gt; { return {}; }
216+
template&lt;<i>constexpr-param</i> T&gt;
217+
constexpr auto operator++(this T, int) noexcept -&gt; constant_wrapper&lt;Y++&gt; { return {}; }
218+
template&lt;<i>constexpr-param</i> T&gt;
219+
constexpr auto operator--(this T) noexcept -&gt; constant_wrapper&lt;--Y&gt; { return {}; }
220+
template&lt;<i>constexpr-param</i> T&gt;
221+
constexpr auto operator--(this T, int) noexcept -&gt; constant_wrapper&lt;Y--&gt; { return {}; }
222+
223+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
224+
constexpr auto operator+=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value += R::value)&gt; { return {}; }
225+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
226+
constexpr auto operator-=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value -= R::value)&gt; { return {}; }
227+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
228+
constexpr auto operator*=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value *= R::value)&gt; { return {}; }
229+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
230+
constexpr auto operator/=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value /= R::value)&gt; { return {}; }
231+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
232+
constexpr auto operator%=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value %= R::value)&gt; { return {}; }
233+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
234+
constexpr auto operator&amp;=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value &amp;= R::value)&gt; { return {}; }
235+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
236+
constexpr auto operator|=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value |= R::value)&gt; { return {}; }
237+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
238+
constexpr auto operator^=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value ^= R::value)&gt; { return {}; }
239+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
240+
constexpr auto operator&lt;&lt;=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value &lt;&lt;= R::value)&gt; { return {}; }
241+
template&lt;<i>constexpr-param</i> T, <i>constexpr-param</i> R&gt;
242+
constexpr auto operator&gt;&gt;=(T, R) noexcept -&gt; constant_wrapper&lt;(T::value &gt;&gt;= R::value)&gt; { return {}; }</ins>
243+
};
244+
}
245+
246+
template&lt;exposition_only::cw_fixed_value X, typename&gt;
247+
struct constant_wrapper: exposition_only::cw_operators {
248+
static constexpr const auto &amp; value = X.data;
249+
using type = constant_wrapper;
250+
using value_type = typename decltype(X)::type;
251+
252+
<del>template&lt;<i>constexpr-param</i> R&gt;
253+
constexpr auto operator=(R) const noexcept requires requires(value_type x) { x = R::value; }
254+
{ return constant_wrapper&lt;[] { auto v = value; return v = R::value; }()&gt;{}; }</del>
255+
<ins>template&lt;<i>constexpr-param</i> R&gt;
256+
constexpr auto operator=(R) const noexcept -&gt; constant_wrapper&lt;X = R::value&gt; { return {}; }</ins>
257+
258+
constexpr operator decltype(auto)() const noexcept { return value; }
259+
};
260+
261+
</pre>
262+
</blockquote>
263+
264+
</li>
265+
266+
</ol>
267+
150268
</resolution>
151269

152270
</issue>

0 commit comments

Comments
 (0)