Skip to content

Commit 476734e

Browse files
committed
New issue from Arthur: "Precondition on inplace_vector::emplace"
1 parent e31d943 commit 476734e

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

xml/issue4147.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4147" status="New">
5+
<title>Precondition on <tt>inplace_vector::emplace</tt></title>
6+
<section><sref ref="[sequence.reqmts]"/></section>
7+
<submitter>Arthur O'Dwyer</submitter>
8+
<date>26 Aug 2024</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
Inserting into the middle of an <tt>inplace_vector</tt>, just like inserting into the middle of a
14+
<tt>vector</tt> or <tt>deque</tt>, requires that we construct the new element out-of-line, shift
15+
down the trailing elements (<i>Cpp17MoveAssignable</i>), and then move-construct the new element
16+
into place (<i>Cpp17MoveInsertable</i>). <paper num="P0843R14"/> failed to make this change, but
17+
it should have.
18+
</p>
19+
</discussion>
20+
21+
<resolution>
22+
<p>
23+
This wording is relative to <paper num="N4988"/>.
24+
</p>
25+
26+
<ol>
27+
<li><p>Modify <sref ref="[sequence.reqmts]"/> as indicated:</p>
28+
29+
<blockquote><pre>
30+
a.emplace(p, args)
31+
</pre>
32+
<blockquote>
33+
<p>
34+
-19- <i>Result</i>: <tt>iterator</tt>.
35+
<p/>
36+
-20- <i>Preconditions</i>: <tt>T</tt> is <i>Cpp17EmplaceConstructible</i> into <tt>X</tt>
37+
from <tt>args</tt>. For <tt>vector</tt><ins>, inplace_vector,</ins> and <tt>deque</tt>,
38+
<tt>T</tt> is also <i>Cpp17MoveInsertable</i> into <tt>X</tt> and <i>Cpp17MoveAssignable</i>.
39+
<p/>
40+
-21- <i>Effects</i>: Inserts an object of type <tt>T</tt> constructed with
41+
<tt>std::forward&lt;Args&gt;(args)...</tt> before <tt>p</tt>.
42+
<p/>
43+
[<i>Note 1</i>: <tt>args</tt> can directly or indirectly refer to a value in <tt>a</tt>.
44+
&mdash; <i>end note</i>]
45+
<p/>
46+
-22- <i>Returns</i>: An iterator that points to the new element constructed from <tt>args</tt>
47+
into <tt>a</tt>.
48+
</p>
49+
</blockquote>
50+
</blockquote>
51+
</li>
52+
53+
</ol>
54+
55+
</resolution>
56+
57+
</issue>

0 commit comments

Comments
 (0)