tmp/tmpobw_usf0/{from.md → to.md}
RENAMED
|
@@ -40,12 +40,13 @@ namespace std {
|
|
| 40 |
typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
|
| 41 |
typedef std::reverse_iterator<iterator> reverse_iterator;
|
| 42 |
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
| 43 |
|
| 44 |
// [vector.cons], construct/copy/destroy:
|
| 45 |
-
|
| 46 |
-
explicit vector(
|
|
|
|
| 47 |
vector(size_type n, const T& value, const Allocator& = Allocator());
|
| 48 |
template <class InputIterator>
|
| 49 |
vector(InputIterator first, InputIterator last,
|
| 50 |
const Allocator& = Allocator());
|
| 51 |
vector(const vector& x);
|
|
@@ -142,24 +143,25 @@ namespace std {
|
|
| 142 |
```
|
| 143 |
|
| 144 |
#### `vector` constructors, copy, and assignment <a id="vector.cons">[[vector.cons]]</a>
|
| 145 |
|
| 146 |
``` cpp
|
| 147 |
-
explicit vector(const Allocator&
|
| 148 |
```
|
| 149 |
|
| 150 |
*Effects:* Constructs an empty `vector`, using the specified allocator.
|
| 151 |
|
| 152 |
*Complexity:* Constant.
|
| 153 |
|
| 154 |
``` cpp
|
| 155 |
-
explicit vector(size_type n);
|
| 156 |
```
|
| 157 |
|
| 158 |
-
*Effects:* Constructs a `vector` with `n`
|
|
|
|
| 159 |
|
| 160 |
-
*Requires:* `T` shall be `
|
| 161 |
|
| 162 |
*Complexity:* Linear in `n`.
|
| 163 |
|
| 164 |
``` cpp
|
| 165 |
vector(size_type n, const T& value,
|
|
@@ -186,33 +188,10 @@ using the specified allocator.
|
|
| 186 |
is the distance between `first` and `last`) and no reallocations if
|
| 187 |
iterators first and last are of forward, bidirectional, or random access
|
| 188 |
categories. It makes order `N` calls to the copy constructor of `T` and
|
| 189 |
order log(N) reallocations if they are just input iterators.
|
| 190 |
|
| 191 |
-
``` cpp
|
| 192 |
-
template <class InputIterator>
|
| 193 |
-
void assign(InputIterator first, InputIterator last);
|
| 194 |
-
```
|
| 195 |
-
|
| 196 |
-
*Effects:*
|
| 197 |
-
|
| 198 |
-
``` cpp
|
| 199 |
-
erase(begin(), end());
|
| 200 |
-
insert(begin(), first, last);
|
| 201 |
-
```
|
| 202 |
-
|
| 203 |
-
``` cpp
|
| 204 |
-
void assign(size_type n, const T& t);
|
| 205 |
-
```
|
| 206 |
-
|
| 207 |
-
*Effects:*
|
| 208 |
-
|
| 209 |
-
``` cpp
|
| 210 |
-
erase(begin(), end());
|
| 211 |
-
insert(begin(), n, t);
|
| 212 |
-
```
|
| 213 |
-
|
| 214 |
#### `vector` capacity <a id="vector.capacity">[[vector.capacity]]</a>
|
| 215 |
|
| 216 |
``` cpp
|
| 217 |
size_type capacity() const noexcept;
|
| 218 |
```
|
|
@@ -222,10 +201,12 @@ requiring reallocation.
|
|
| 222 |
|
| 223 |
``` cpp
|
| 224 |
void reserve(size_type n);
|
| 225 |
```
|
| 226 |
|
|
|
|
|
|
|
| 227 |
*Effects:* A directive that informs a `vector` of a planned change in
|
| 228 |
size, so that it can manage the storage allocation accordingly. After
|
| 229 |
`reserve()`, `capacity()` is greater or equal to the argument of
|
| 230 |
`reserve` if reallocation happens; and equal to the previous value of
|
| 231 |
`capacity()` otherwise. Reallocation happens at this point if and only
|
|
@@ -237,22 +218,28 @@ non-`CopyInsertable` type, there are no effects.
|
|
| 237 |
most linear time in the size of the sequence.
|
| 238 |
|
| 239 |
*Throws:* `length_error` if `n > max_size()`.[^4]
|
| 240 |
|
| 241 |
*Remarks:* Reallocation invalidates all the references, pointers, and
|
| 242 |
-
iterators referring to the elements in the sequence.
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
|
| 247 |
``` cpp
|
| 248 |
void shrink_to_fit();
|
| 249 |
```
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
*Remarks:* `shrink_to_fit` is a non-binding request to reduce
|
| 252 |
`capacity()` to `size()`. The request is non-binding to allow latitude
|
| 253 |
-
for implementation-specific optimizations.
|
|
|
|
|
|
|
| 254 |
|
| 255 |
``` cpp
|
| 256 |
void swap(vector& x);
|
| 257 |
```
|
| 258 |
|
|
@@ -263,34 +250,32 @@ of `x`.
|
|
| 263 |
|
| 264 |
``` cpp
|
| 265 |
void resize(size_type sz);
|
| 266 |
```
|
| 267 |
|
| 268 |
-
*Effects:* If `sz <= size()`, equivalent to
|
| 269 |
-
`
|
| 270 |
-
|
| 271 |
|
| 272 |
-
*Requires:* `T` shall be `
|
|
|
|
| 273 |
|
| 274 |
-
|
| 275 |
-
void resize(size_type sz, const T& c);
|
| 276 |
-
```
|
| 277 |
-
|
| 278 |
-
*Effects:*
|
| 279 |
-
|
| 280 |
-
``` cpp
|
| 281 |
-
if (sz > size())
|
| 282 |
-
insert(end(), sz-size(), c);
|
| 283 |
-
else if (sz < size())
|
| 284 |
-
erase(begin()+sz, end());
|
| 285 |
-
else
|
| 286 |
-
; // do nothing
|
| 287 |
-
```
|
| 288 |
-
|
| 289 |
-
*Requires:* If an exception is thrown other than by the move constructor
|
| 290 |
of a non-`CopyInsertable` `T` there are no effects.
|
| 291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
#### `vector` data <a id="vector.data">[[vector.data]]</a>
|
| 293 |
|
| 294 |
``` cpp
|
| 295 |
T* data() noexcept;
|
| 296 |
const T* data() const noexcept;
|
|
@@ -320,12 +305,15 @@ void push_back(T&& x);
|
|
| 320 |
*Remarks:* Causes reallocation if the new size is greater than the old
|
| 321 |
capacity. If no reallocation happens, all the iterators and references
|
| 322 |
before the insertion point remain valid. If an exception is thrown other
|
| 323 |
than by the copy constructor, move constructor, assignment operator, or
|
| 324 |
move assignment operator of `T` or by any `InputIterator` operation
|
| 325 |
-
there are no effects. If an exception is thrown
|
| 326 |
-
|
|
|
|
|
|
|
|
|
|
| 327 |
|
| 328 |
*Complexity:* The complexity is linear in the number of elements
|
| 329 |
inserted plus the distance to the end of the vector.
|
| 330 |
|
| 331 |
``` cpp
|
|
|
|
| 40 |
typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
|
| 41 |
typedef std::reverse_iterator<iterator> reverse_iterator;
|
| 42 |
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
| 43 |
|
| 44 |
// [vector.cons], construct/copy/destroy:
|
| 45 |
+
vector() : vector(Allocator()) { }
|
| 46 |
+
explicit vector(const Allocator&);
|
| 47 |
+
explicit vector(size_type n, const Allocator& = Allocator());
|
| 48 |
vector(size_type n, const T& value, const Allocator& = Allocator());
|
| 49 |
template <class InputIterator>
|
| 50 |
vector(InputIterator first, InputIterator last,
|
| 51 |
const Allocator& = Allocator());
|
| 52 |
vector(const vector& x);
|
|
|
|
| 143 |
```
|
| 144 |
|
| 145 |
#### `vector` constructors, copy, and assignment <a id="vector.cons">[[vector.cons]]</a>
|
| 146 |
|
| 147 |
``` cpp
|
| 148 |
+
explicit vector(const Allocator&);
|
| 149 |
```
|
| 150 |
|
| 151 |
*Effects:* Constructs an empty `vector`, using the specified allocator.
|
| 152 |
|
| 153 |
*Complexity:* Constant.
|
| 154 |
|
| 155 |
``` cpp
|
| 156 |
+
explicit vector(size_type n, const Allocator& = Allocator());
|
| 157 |
```
|
| 158 |
|
| 159 |
+
*Effects:* Constructs a `vector` with `n` default-inserted elements
|
| 160 |
+
using the specified allocator.
|
| 161 |
|
| 162 |
+
*Requires:* `T` shall be `DefaultInsertable` into `*this`.
|
| 163 |
|
| 164 |
*Complexity:* Linear in `n`.
|
| 165 |
|
| 166 |
``` cpp
|
| 167 |
vector(size_type n, const T& value,
|
|
|
|
| 188 |
is the distance between `first` and `last`) and no reallocations if
|
| 189 |
iterators first and last are of forward, bidirectional, or random access
|
| 190 |
categories. It makes order `N` calls to the copy constructor of `T` and
|
| 191 |
order log(N) reallocations if they are just input iterators.
|
| 192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
#### `vector` capacity <a id="vector.capacity">[[vector.capacity]]</a>
|
| 194 |
|
| 195 |
``` cpp
|
| 196 |
size_type capacity() const noexcept;
|
| 197 |
```
|
|
|
|
| 201 |
|
| 202 |
``` cpp
|
| 203 |
void reserve(size_type n);
|
| 204 |
```
|
| 205 |
|
| 206 |
+
*Requires:* `T` shall be `MoveInsertable` into `*this`.
|
| 207 |
+
|
| 208 |
*Effects:* A directive that informs a `vector` of a planned change in
|
| 209 |
size, so that it can manage the storage allocation accordingly. After
|
| 210 |
`reserve()`, `capacity()` is greater or equal to the argument of
|
| 211 |
`reserve` if reallocation happens; and equal to the previous value of
|
| 212 |
`capacity()` otherwise. Reallocation happens at this point if and only
|
|
|
|
| 218 |
most linear time in the size of the sequence.
|
| 219 |
|
| 220 |
*Throws:* `length_error` if `n > max_size()`.[^4]
|
| 221 |
|
| 222 |
*Remarks:* Reallocation invalidates all the references, pointers, and
|
| 223 |
+
iterators referring to the elements in the sequence. No reallocation
|
| 224 |
+
shall take place during insertions that happen after a call to
|
| 225 |
+
`reserve()` until the time when an insertion would make the size of the
|
| 226 |
+
vector greater than the value of `capacity()`.
|
| 227 |
|
| 228 |
``` cpp
|
| 229 |
void shrink_to_fit();
|
| 230 |
```
|
| 231 |
|
| 232 |
+
*Requires:* `T` shall be `MoveInsertable` into `*this`.
|
| 233 |
+
|
| 234 |
+
*Complexity:* Linear in the size of the sequence.
|
| 235 |
+
|
| 236 |
*Remarks:* `shrink_to_fit` is a non-binding request to reduce
|
| 237 |
`capacity()` to `size()`. The request is non-binding to allow latitude
|
| 238 |
+
for implementation-specific optimizations. If an exception is thrown
|
| 239 |
+
other than by the move constructor of a non-`CopyInsertable` `T` there
|
| 240 |
+
are no effects.
|
| 241 |
|
| 242 |
``` cpp
|
| 243 |
void swap(vector& x);
|
| 244 |
```
|
| 245 |
|
|
|
|
| 250 |
|
| 251 |
``` cpp
|
| 252 |
void resize(size_type sz);
|
| 253 |
```
|
| 254 |
|
| 255 |
+
*Effects:* If `sz <= size()`, equivalent to calling `pop_back()`
|
| 256 |
+
`size() - sz` times. If `size() < sz`, appends `sz - size()`
|
| 257 |
+
default-inserted elements to the sequence.
|
| 258 |
|
| 259 |
+
*Requires:* `T` shall be `MoveInsertable` and `DefaultInsertable` into
|
| 260 |
+
`*this`.
|
| 261 |
|
| 262 |
+
*Remarks:* If an exception is thrown other than by the move constructor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
of a non-`CopyInsertable` `T` there are no effects.
|
| 264 |
|
| 265 |
+
``` cpp
|
| 266 |
+
void resize(size_type sz, const T& c);
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
*Effects:* If `sz <= size()`, equivalent to calling `pop_back()`
|
| 270 |
+
`size() - sz` times. If `size() < sz`, appends `sz - size()` copies of
|
| 271 |
+
`c` to the sequence.
|
| 272 |
+
|
| 273 |
+
*Requires:* `T` shall be `CopyInsertable` into `*this`.
|
| 274 |
+
|
| 275 |
+
*Remarks:* If an exception is thrown there are no effects.
|
| 276 |
+
|
| 277 |
#### `vector` data <a id="vector.data">[[vector.data]]</a>
|
| 278 |
|
| 279 |
``` cpp
|
| 280 |
T* data() noexcept;
|
| 281 |
const T* data() const noexcept;
|
|
|
|
| 305 |
*Remarks:* Causes reallocation if the new size is greater than the old
|
| 306 |
capacity. If no reallocation happens, all the iterators and references
|
| 307 |
before the insertion point remain valid. If an exception is thrown other
|
| 308 |
than by the copy constructor, move constructor, assignment operator, or
|
| 309 |
move assignment operator of `T` or by any `InputIterator` operation
|
| 310 |
+
there are no effects. If an exception is thrown while inserting a single
|
| 311 |
+
element at the end and `T` is `CopyInsertable` or
|
| 312 |
+
`is_nothrow_move_constructible<T>::value` is `true`, there are no
|
| 313 |
+
effects. Otherwise, if an exception is thrown by the move constructor of
|
| 314 |
+
a non-`CopyInsertable` `T`, the effects are unspecified.
|
| 315 |
|
| 316 |
*Complexity:* The complexity is linear in the number of elements
|
| 317 |
inserted plus the distance to the end of the vector.
|
| 318 |
|
| 319 |
``` cpp
|