Skip to content

Commit 0d00e12

Browse files
committed
Update PR for 4383.
1 parent 02ef747 commit 0d00e12

File tree

1 file changed

+117
-1
lines changed

1 file changed

+117
-1
lines changed

xml/issue4383.xml

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

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

147263
</discussion>
148264

0 commit comments

Comments
 (0)