88</section >
99<submitter >Jiang An</submitter >
1010<date >15 Mar 2025</date >
11- <priority >99 </priority >
11+ <priority >3 </priority >
1212
1313<discussion >
1414<p >
@@ -24,9 +24,133 @@ The specific `resize` exception guarantee for `std::vector` came from resolving
2424later effectively copied to `std::inplace_vector` because that container's specification should resemble
2525as much as possible that of `std::vector`.
2626</p >
27+
28+ <note >2025-10-16; Reflector poll</note >
29+ <p >
30+ Set priority to 3 after reflector poll.
31+ </p >
32+
33+ <note >2025-10-16; Jonathan provides wording</note >
34+ <p >
35+ LWG <iref ref =" 4106" /> already fixed this for `std::forward_list`.
36+ For `std::list` the "If an exception is thrown, there are no effects" wording
37+ in <sref ref =" [list.modifiers]" /> p2 doesn't apply to `std::list::resize`
38+ because it's in a different subclause (<sref ref =" [list.capacity]" />).
39+ We can fix that though.
40+ </p >
41+
2742</discussion >
2843
2944<resolution >
45+ <p >
46+ This wording is relative to <paper num =" N5014" />.
47+ </p >
48+
49+ <ol >
50+
51+ <li ><p >Modify <sref ref =" [deque.capacity]" /> as indicated:</p >
52+
53+ <blockquote >
54+ <pre >
55+ constexpr void resize(size_type sz);
56+ </pre >
57+ <blockquote >
58+ <p >
59+ -1- <em >Preconditions</em >:
60+ `T` is <em >Cpp17MoveInsertable</em > and <em >Cpp17DefaultInsertable</em >
61+ into `deque`.
62+ </p >
63+ <p >
64+ -2- <em >Effects</em >:
65+ If <code >sz < size()</code > <ins >is `true`</ins >,
66+ erases the last `size() - sz` elements from the sequence.
67+ Otherwise, appends `sz - size()` default-inserted elements to the sequence.
68+ <ins >
69+ If an exception is thrown, there is no effect on the container.
70+ </ins >
71+ </p >
72+ </blockquote >
73+
74+ <pre >
75+ constexpr void resize(size_type sz, const T& c);
76+ </pre >
77+ <blockquote >
78+ <p >
79+ -3- <em >Preconditions</em >:
80+ `T` is <em >Cpp17CopyInsertable</em >
81+ into `deque`.
82+ </p >
83+ <p >
84+ -4- <em >Effects</em >:
85+ If <code >sz < size()</code > <ins >is `true`</ins >,
86+ erases the last `size() - sz` elements from the sequence.
87+ Otherwise, appends `sz - size()` copies of `c` to the sequence.
88+ <ins >
89+ If an exception is thrown, there is no effect on the container.
90+ </ins >
91+ </p >
92+ </blockquote >
93+
94+ </blockquote >
95+ </li >
96+
97+ <li ><p >Modify <sref ref =" [list.capacity]" /> as indicated:</p >
98+
99+ <blockquote >
100+
101+ <pre >
102+ constexpr void resize(size_type sz);
103+ </pre >
104+ <blockquote >
105+ <p >
106+ -1- <em >Preconditions</em >:
107+ `T` is <em >Cpp17DefaultInsertable</em > into `list`.
108+ </p >
109+ <p >
110+ -2- <em >Effects</em >:
111+ If <code >size() < sz</code > <ins >is `true`</ins >,
112+ appends `sz - size()` default-inserted elements to the sequence.
113+ If <code >sz < = size()</code > <ins >is `true`</ins >,
114+ equivalent to:
115+ <blockquote ><pre >list< T> ::iterator it = begin();
116+ advance(it, sz);
117+ erase(it, end());
118+ </pre ></blockquote >
119+ <ins >
120+ If an exception is thrown, there is no effect on the container.
121+ </ins >
122+ </p >
123+ </blockquote >
124+
125+ <pre >
126+ constexpr void resize(size_type sz, const T& c);
127+ </pre >
128+ <blockquote >
129+ <p >
130+ -3- <em >Preconditions</em >:
131+ `T` is <em >Cpp17CopyInsertable</em > into `list`.
132+ </p >
133+ <p >
134+ -4- <em >Effects</em >:
135+ <del >As if by</del > <ins >Equivalent to</ins >:
136+ <blockquote ><pre >if (sz < size()
137+ insert(end(), sz-size(), c);
138+ else if (sz < size()) {
139+ iterator i = begin();
140+ advance(it, sz);
141+ erase(it, end());
142+ }
143+ else
144+ ; <i >// do nothing</i >
145+ </pre ></blockquote >
146+ </p >
147+ </blockquote >
148+
149+ </blockquote >
150+ </li >
151+
152+ </ol >
153+
30154</resolution >
31155
32156</issue >
0 commit comments