From Jason Turner

[deque]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpf2a2_v4s/{from.md → to.md} +28 -49
tmp/tmpf2a2_v4s/{from.md → to.md} RENAMED
@@ -36,12 +36,13 @@ namespace std {
36
  typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
37
  typedef std::reverse_iterator<iterator> reverse_iterator;
38
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
39
 
40
  // [deque.cons], construct/copy/destroy:
41
- explicit deque(const Allocator& = Allocator());
42
- explicit deque(size_type n);
 
43
  deque(size_type n, const T& value, const Allocator& = Allocator());
44
  template <class InputIterator>
45
  deque(InputIterator first, InputIterator last, const Allocator& = Allocator());
46
  deque(const deque& x);
47
  deque(deque&&);
@@ -138,24 +139,25 @@ namespace std {
138
  ```
139
 
140
  #### `deque` constructors, copy, and assignment <a id="deque.cons">[[deque.cons]]</a>
141
 
142
  ``` cpp
143
- explicit deque(const Allocator& = Allocator());
144
  ```
145
 
146
  *Effects:* Constructs an empty `deque`, using the specified allocator.
147
 
148
  *Complexity:* Constant.
149
 
150
  ``` cpp
151
- explicit deque(size_type n);
152
  ```
153
 
154
- *Effects:* Constructs a `deque` with `n` value-initialized elements.
 
155
 
156
- *Requires:* `T` shall be `DefaultConstructible`.
157
 
158
  *Complexity:* Linear in `n`.
159
 
160
  ``` cpp
161
  deque(size_type n, const T& value,
@@ -176,71 +178,46 @@ template <class InputIterator>
176
  ```
177
 
178
  *Effects:* Constructs a `deque` equal to the range \[`first`, `last`),
179
  using the specified allocator.
180
 
181
- *Complexity:* `distance(first, last)`.
182
-
183
- ``` cpp
184
- template <class InputIterator>
185
- void assign(InputIterator first, InputIterator last);
186
- ```
187
-
188
- *Effects:*
189
-
190
- ``` cpp
191
- erase(begin(), end());
192
- insert(begin(), first, last);
193
- ```
194
-
195
- ``` cpp
196
- void assign(size_type n, const T& t);
197
- ```
198
-
199
- *Effects:*
200
-
201
- ``` cpp
202
- erase(begin(), end());
203
- insert(begin(), n, t);
204
- ```
205
 
206
  #### `deque` capacity <a id="deque.capacity">[[deque.capacity]]</a>
207
 
208
  ``` cpp
209
  void resize(size_type sz);
210
  ```
211
 
212
- *Effects:* If `sz <= size()`, equivalent to
213
- `erase(begin() + sz, end());`. If `size() < sz`, appends `sz - size()`
214
- value-initialized elements to the sequence.
215
 
216
- *Requires:* `T` shall be `DefaultConstructible`.
 
217
 
218
  ``` cpp
219
  void resize(size_type sz, const T& c);
220
  ```
221
 
222
- *Effects:*
223
-
224
- ``` cpp
225
- if (sz > size())
226
- insert(end(), sz-size(), c);
227
- else if (sz < size())
228
- erase(begin()+sz, end());
229
- else
230
- ; // do nothing
231
- ```
232
 
233
  *Requires:* `T` shall be `CopyInsertable` into `*this`.
234
 
235
  ``` cpp
236
  void shrink_to_fit();
237
  ```
238
 
239
- *Remarks:* `shrink_to_fit` is a non-binding request to reduce memory
240
- use. The request is non-binding to allow latitude for
241
- implementation-specific optimizations.
 
 
 
 
242
 
243
  #### `deque` modifiers <a id="deque.modifiers">[[deque.modifiers]]</a>
244
 
245
  ``` cpp
246
  iterator insert(const_iterator position, const T& x);
@@ -265,12 +242,14 @@ iterators and references to elements of the deque. An insertion at
265
  either end of the deque invalidates all the iterators to the deque, but
266
  has no effect on the validity of references to elements of the deque.
267
 
268
  *Remarks:* If an exception is thrown other than by the copy constructor,
269
  move constructor, assignment operator, or move assignment operator of
270
- `T` there are no effects. If an exception is thrown by the move
271
- constructor of a non-`CopyInsertable` `T`, the effects are unspecified.
 
 
272
 
273
  *Complexity:* The complexity is linear in the number of elements
274
  inserted plus the lesser of the distances to the beginning and end of
275
  the deque. Inserting a single element either at the beginning or end of
276
  a deque always takes constant time and causes a single call to a
 
36
  typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
37
  typedef std::reverse_iterator<iterator> reverse_iterator;
38
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
39
 
40
  // [deque.cons], construct/copy/destroy:
41
+ deque() : deque(Allocator()) { }
42
+ explicit deque(const Allocator&);
43
+ explicit deque(size_type n, const Allocator& = Allocator());
44
  deque(size_type n, const T& value, const Allocator& = Allocator());
45
  template <class InputIterator>
46
  deque(InputIterator first, InputIterator last, const Allocator& = Allocator());
47
  deque(const deque& x);
48
  deque(deque&&);
 
139
  ```
140
 
141
  #### `deque` constructors, copy, and assignment <a id="deque.cons">[[deque.cons]]</a>
142
 
143
  ``` cpp
144
+ explicit deque(const Allocator&);
145
  ```
146
 
147
  *Effects:* Constructs an empty `deque`, using the specified allocator.
148
 
149
  *Complexity:* Constant.
150
 
151
  ``` cpp
152
+ explicit deque(size_type n, const Allocator& = Allocator());
153
  ```
154
 
155
+ *Effects:* Constructs a `deque` with `n` default-inserted elements using
156
+ the specified allocator.
157
 
158
+ *Requires:* `T` shall be `DefaultInsertable` into `*this`.
159
 
160
  *Complexity:* Linear in `n`.
161
 
162
  ``` cpp
163
  deque(size_type n, const T& value,
 
178
  ```
179
 
180
  *Effects:* Constructs a `deque` equal to the range \[`first`, `last`),
181
  using the specified allocator.
182
 
183
+ *Complexity:* Linear in `distance(first, last)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
  #### `deque` capacity <a id="deque.capacity">[[deque.capacity]]</a>
186
 
187
  ``` cpp
188
  void resize(size_type sz);
189
  ```
190
 
191
+ *Effects:* If `sz <= size()`, equivalent to calling `pop_back()`
192
+ `size() - sz` times. If `size() < sz`, appends `sz - size()`
193
+ default-inserted elements to the sequence.
194
 
195
+ *Requires:* `T` shall be `MoveInsertable` and `DefaultInsertable` into
196
+ `*this`.
197
 
198
  ``` cpp
199
  void resize(size_type sz, const T& c);
200
  ```
201
 
202
+ *Effects:* If `sz <= size()`, equivalent to calling `pop_back()`
203
+ `size() - sz` times. If `size() < sz`, appends `sz - size()` copies of
204
+ `c` to the sequence.
 
 
 
 
 
 
 
205
 
206
  *Requires:* `T` shall be `CopyInsertable` into `*this`.
207
 
208
  ``` cpp
209
  void shrink_to_fit();
210
  ```
211
 
212
+ *Requires:* `T` shall be `MoveInsertable` into `*this`.
213
+
214
+ *Complexity:* Linear in the size of the sequence.
215
+
216
+ *Remarks:* `shrink_to_fit` is a non-binding request to reduce memory use
217
+ but does not change the size of the sequence. The request is non-binding
218
+ to allow latitude for implementation-specific optimizations.
219
 
220
  #### `deque` modifiers <a id="deque.modifiers">[[deque.modifiers]]</a>
221
 
222
  ``` cpp
223
  iterator insert(const_iterator position, const T& x);
 
242
  either end of the deque invalidates all the iterators to the deque, but
243
  has no effect on the validity of references to elements of the deque.
244
 
245
  *Remarks:* If an exception is thrown other than by the copy constructor,
246
  move constructor, assignment operator, or move assignment operator of
247
+ `T` there are no effects. If an exception is thrown while inserting a
248
+ single element at either end, there are no effects. Otherwise, if an
249
+ exception is thrown by the move constructor of a non-`CopyInsertable`
250
+ `T`, the effects are unspecified.
251
 
252
  *Complexity:* The complexity is linear in the number of elements
253
  inserted plus the lesser of the distances to the beginning and end of
254
  the deque. Inserting a single element either at the beginning or end of
255
  a deque always takes constant time and causes a single call to a