Skip to content

Commit 653c7b8

Browse files
authored
Merge pull request #523 from tomaszkam/tk/pr-update
Updated PR for 4264,4308
2 parents 6c8d551 + 720b94b commit 653c7b8

File tree

2 files changed

+146
-4
lines changed

2 files changed

+146
-4
lines changed

xml/issue4264.xml

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,8 @@ Set priority to 2 after reflector poll.
173173
Strong oposition to making it unspecified whether <tt>function_ref</tt> constructed from
174174
other <tt>function_ref</tt> will reference source object or its target directly.
175175
</p>
176-
</discussion>
177176

178-
<resolution>
177+
<superseded>
179178
<p>
180179
This wording is relative to <paper num="N5008"/>.
181180
</p>
@@ -237,6 +236,75 @@ f2(); // it is unspecified if `f1` or `f2` is invoked</ins>
237236
</li>
238237
</ol>
239238

239+
</superseded>
240+
241+
<note>2025-11-06, Tomasz provides updated wording correcting example</note>
242+
243+
</discussion>
244+
245+
<resolution>
246+
<p>
247+
This wording is relative to <paper num="N5014"/>.
248+
</p>
249+
<ol>
250+
251+
<li><p>Modify <sref ref="[func.wrap.general]"/> as indicated:</p>
252+
253+
<blockquote>
254+
<p>
255+
-2- Let <tt>t</tt> be an object of a type that is a specialization of <tt>function</tt>,
256+
<tt>copyable_function</tt>, <del>or</del> <tt>move_only_function</tt><ins>, or <tt>function_ref</tt></ins>,
257+
such that the target object <tt>x</tt> of <tt>t</tt> has a type that is a specialization of <tt>function</tt>,
258+
<tt>copyable_function</tt>, <del>or</del><tt>move_only_function</tt><ins>, or <tt>function_ref</tt></ins>.
259+
Each argument of the invocation of <tt>x</tt> evaluated as part of the invocation of <tt>t</tt>
260+
may alias an argument in the same position in the invocation of <tt>t</tt> that has the same type,
261+
even if the corresponding parameter is not of reference type.
262+
</p>
263+
</blockquote>
264+
265+
</li>
266+
267+
<li><p>Modify <sref ref="[func.wrap.ref.ctor]"/> as indicated:</p>
268+
269+
<blockquote>
270+
<pre>
271+
template&lt;class F&gt; constexpr function_ref(F&amp;&amp;) noexcept;
272+
</pre>
273+
<blockquote>
274+
[&hellip;]
275+
<p>
276+
-7- <i>Effects</i>:
277+
Initializes <tt><i>bound-entity</i></tt> with <tt>addressof(f)</tt>
278+
and <tt><i>thunk-ptr</i></tt> with the address of a function <tt><i>thunk</i></tt> such that
279+
<tt><i>thunk</i>(<i>bound-entity</i>, <i>call-args</i>...)</tt> is expression-equivalent
280+
(<sref ref="[defns.expression.equivalent]"/>) to
281+
<tt>invoke_r&lt;R&gt;(static_cast&lt;cv T&amp;&gt;(f), <i>call-args</i>...)</tt>.
282+
</p>
283+
<p>
284+
<ins>-?- <i>Remarks</i>:
285+
If <tt>remove_cvref_t&lt;F&gt;</tt> is a specialization of <tt>function_ref</tt> an implementation
286+
may initialize <tt><i>bound-entity</i></tt> with <tt><i>bound-entity</i></tt> of <tt>f</tt>.
287+
[<i>Example</i>:</ins>
288+
</p>
289+
<pre>
290+
<ins>void f1() noexcept;
291+
void f2() noexcept;
292+
293+
function_ref&lt;void() noexcept&gt; r1(&amp;f1);
294+
function_ref&lt;void()&gt; r2(r1);
295+
r2(); // f1 is invoked
296+
r1 = &amp;f2;
297+
r2(); // it is unspecified if f1 or f2 is invoked</ins>
298+
</pre>
299+
<p>
300+
<ins>&mdash; <i>end example</i>]</ins>
301+
</p>
302+
</blockquote>
303+
</blockquote>
304+
305+
</li>
306+
</ol>
307+
240308

241309
</resolution>
242310

xml/issue4308.xml

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ The aliases shouldn't be defined for non-object types, but probably harmless."
3838
<p>
3939
<tt>optional&lt;T&amp;&gt;</tt> doesn't currently allow incomplete types anyway.
4040
</p>
41-
</discussion>
4241

43-
<resolution>
42+
<superseded>
4443
<p>
4544
This wording is relative to <paper num="N5014"/>.
4645
</p>
@@ -79,7 +78,82 @@ type because it is not an actual iterator type. &mdash; <i>end note</i>]</ins>
7978

8079
</li>
8180

81+
</ol>
82+
</superseded>
83+
84+
<note>2025-11-06, Tomasz provides updated</note>
85+
</discussion>
86+
87+
<resolution>
88+
89+
<ol>
90+
91+
<li><p>Modify <sref ref="[optional.optional.ref.general]"/> as indicated:</p>
92+
<blockquote>
93+
<pre>
94+
namespace std {
95+
template&lt;class T&gt;
96+
class optional&lt;T&amp;&gt; {
97+
public:
98+
using value_type = T;
99+
using iterator = implementation-defined; // <ins>present only if T is object type other than array of unknown bound;</ins> see [optional.ref.iterators]
100+
public:
101+
[&hellip;]
102+
103+
// [optional.ref.iterators], iterator support
104+
constexpr <del>iterator</del><ins>auto</ins> begin() const noexcept;
105+
constexpr <del>iterator</del><ins>auto</ins> end() const noexcept;
106+
107+
[&hellip;]
108+
};
109+
}
110+
</pre>
111+
</blockquote>
112+
</li>
113+
<li><p>Modify <sref ref="[optional.ref.iterators]"/> as indicated:</p>
114+
115+
<blockquote>
116+
<pre>
117+
using iterator = <i>implementation-defined</i>; <ins>// present only if T is object type other than array of unknown bound</ins>
118+
</pre>
119+
<blockquote>
120+
<p>
121+
-1- This type models `contiguous_iterator` (<sref ref="[iterator.concept.contiguous]"/>), meets the
122+
<i>Cpp17RandomAccessIterator</i> requirements (<sref ref="[random.access.iterators]"/>), and meets
123+
the requirements for constexpr iterators (<sref ref="[iterator.requirements.general]"/>), with value
124+
type <tt>remove_cv_t&lt;T&gt;</tt>. The reference type is <tt>T&amp;</tt> for `iterator`.
125+
</p>
126+
<p>
127+
-2- All requirements on container iterators (<sref ref="[container.reqmts]"/>) apply to
128+
`optional::iterator`.
129+
</p>
130+
</blockquote>
131+
132+
<pre>
133+
constexpr <del>iterator</del><ins>auto</ins> begin() const noexcept;
134+
</pre>
135+
<blockquote>
136+
<p><ins>-?- <i>Constraints</i>: T is an object type other than array of unknown bound.</ins></p>
137+
<p>
138+
-3- Returns: <ins>An object `i` of `iterator` type, such that</ins><del>If `has_value()` is `true`,</del>
139+
<ins>`i` is</ins> an iterator referring to `*val` <ins>if `has_value()` is `true`, and</ins><del>Otherwise, </del>
140+
a past-the-end iterator value <ins>otherwise</ins>.
141+
</p>
142+
</blockquote>
143+
144+
<pre>
145+
constexpr <del>iterator</del><ins>auto</ins> end() const noexcept;
146+
</pre>
147+
<blockquote>
148+
<p><ins>-?- <i>Constraints</i>: T is an object type other than array of unknown bound.</ins></p>
149+
<p>-4- Returns: `begin() + has_value()`.</p>
150+
</blockquote>
151+
</blockquote>
152+
153+
</li>
154+
82155
</ol>
83156
</resolution>
84157

158+
85159
</issue>

0 commit comments

Comments
 (0)