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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Containers <a id="container.reqmts">[[container.reqmts]]</a>
|
| 2 |
+
|
| 3 |
+
A type `X` meets the *container* requirements if the following types,
|
| 4 |
+
statements, and expressions are well-formed and have the specified
|
| 5 |
+
semantics.
|
| 6 |
+
|
| 7 |
+
``` cpp
|
| 8 |
+
typename X::value_type
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
*Result:* `T`
|
| 12 |
+
|
| 13 |
+
*Preconditions:* `T` is *Cpp17Erasable* from `X`
|
| 14 |
+
(see [[container.alloc.reqmts]], below).
|
| 15 |
+
|
| 16 |
+
``` cpp
|
| 17 |
+
typename X::reference
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
*Result:* `T&`
|
| 21 |
+
|
| 22 |
+
``` cpp
|
| 23 |
+
typename X::const_reference
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
*Result:* `const T&`
|
| 27 |
+
|
| 28 |
+
``` cpp
|
| 29 |
+
typename X::iterator
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
*Result:* A type that meets the forward iterator
|
| 33 |
+
requirements [[forward.iterators]] with value type `T`. The type
|
| 34 |
+
`X::iterator` is convertible to `X::const_iterator`.
|
| 35 |
+
|
| 36 |
+
``` cpp
|
| 37 |
+
typename X::const_iterator
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
*Result:* A type that meets the requirements of a constant iterator and
|
| 41 |
+
those of a forward iterator with value type `T`.
|
| 42 |
+
|
| 43 |
+
``` cpp
|
| 44 |
+
typename X::difference_type
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
*Result:* A signed integer type, identical to the difference type of
|
| 48 |
+
`X::iterator` and `X::const_iterator`.
|
| 49 |
+
|
| 50 |
+
``` cpp
|
| 51 |
+
typename X::size_type
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
*Result:* An unsigned integer type that can represent any non-negative
|
| 55 |
+
value of `X::difference_type`.
|
| 56 |
+
|
| 57 |
+
``` cpp
|
| 58 |
+
X u;
|
| 59 |
+
X u = X();
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
*Ensures:* `u.empty()`
|
| 63 |
+
|
| 64 |
+
*Complexity:* Constant.
|
| 65 |
+
|
| 66 |
+
``` cpp
|
| 67 |
+
X u(v);
|
| 68 |
+
X u = v;
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
*Preconditions:* `T` is *Cpp17CopyInsertable* into `X` (see below).
|
| 72 |
+
|
| 73 |
+
*Ensures:* `u == v`.
|
| 74 |
+
|
| 75 |
+
*Complexity:* Linear.
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
X u(rv);
|
| 79 |
+
X u = rv;
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
*Ensures:* `u` is equal to the value that `rv` had before this
|
| 83 |
+
construction.
|
| 84 |
+
|
| 85 |
+
*Complexity:* Linear for `array` and constant for all other standard
|
| 86 |
+
containers.
|
| 87 |
+
|
| 88 |
+
``` cpp
|
| 89 |
+
t = v;
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
*Result:* `X&`.
|
| 93 |
+
|
| 94 |
+
*Ensures:* `t == v`.
|
| 95 |
+
|
| 96 |
+
*Complexity:* Linear.
|
| 97 |
+
|
| 98 |
+
``` cpp
|
| 99 |
+
t = rv
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
*Result:* `X&`.
|
| 103 |
+
|
| 104 |
+
*Effects:* All existing elements of `t` are either move assigned to or
|
| 105 |
+
destroyed.
|
| 106 |
+
|
| 107 |
+
*Ensures:* If `t` and `rv` do not refer to the same object, `t` is equal
|
| 108 |
+
to the value that `rv` had before this assignment.
|
| 109 |
+
|
| 110 |
+
*Complexity:* Linear.
|
| 111 |
+
|
| 112 |
+
``` cpp
|
| 113 |
+
a.~X()
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
*Result:* `void`.
|
| 117 |
+
|
| 118 |
+
*Effects:* Destroys every element of `a`; any memory obtained is
|
| 119 |
+
deallocated.
|
| 120 |
+
|
| 121 |
+
*Complexity:* Linear.
|
| 122 |
+
|
| 123 |
+
``` cpp
|
| 124 |
+
b.begin()
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
*Result:* `iterator`; `const_iterator` for constant `b`.
|
| 128 |
+
|
| 129 |
+
*Returns:* An iterator referring to the first element in the container.
|
| 130 |
+
|
| 131 |
+
*Complexity:* Constant.
|
| 132 |
+
|
| 133 |
+
``` cpp
|
| 134 |
+
b.end()
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
*Result:* `iterator`; `const_iterator` for constant `b`.
|
| 138 |
+
|
| 139 |
+
*Returns:* An iterator which is the past-the-end value for the
|
| 140 |
+
container.
|
| 141 |
+
|
| 142 |
+
*Complexity:* Constant.
|
| 143 |
+
|
| 144 |
+
``` cpp
|
| 145 |
+
b.cbegin()
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
*Result:* `const_iterator`.
|
| 149 |
+
|
| 150 |
+
*Returns:* `const_cast<X const&>(b).begin()`
|
| 151 |
+
|
| 152 |
+
*Complexity:* Constant.
|
| 153 |
+
|
| 154 |
+
``` cpp
|
| 155 |
+
b.cend()
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
*Result:* `const_iterator`.
|
| 159 |
+
|
| 160 |
+
*Returns:* `const_cast<X const&>(b).end()`
|
| 161 |
+
|
| 162 |
+
*Complexity:* Constant.
|
| 163 |
+
|
| 164 |
+
``` cpp
|
| 165 |
+
i <=> j
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
*Result:* `strong_ordering`.
|
| 169 |
+
|
| 170 |
+
*Constraints:* `X::iterator` meets the random access iterator
|
| 171 |
+
requirements.
|
| 172 |
+
|
| 173 |
+
*Complexity:* Constant.
|
| 174 |
+
|
| 175 |
+
``` cpp
|
| 176 |
+
c == b
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
*Preconditions:* `T` meets the *Cpp17EqualityComparable* requirements.
|
| 180 |
+
|
| 181 |
+
*Result:* `bool`.
|
| 182 |
+
|
| 183 |
+
*Returns:* `equal(c.begin(), c.end(), b.begin(), b.end())`
|
| 184 |
+
|
| 185 |
+
[*Note 1*: The algorithm `equal` is defined in
|
| 186 |
+
[[alg.equal]]. — *end note*]
|
| 187 |
+
|
| 188 |
+
*Complexity:* Constant if `c.size() != b.size()`, linear otherwise.
|
| 189 |
+
|
| 190 |
+
*Remarks:* `==` is an equivalence relation.
|
| 191 |
+
|
| 192 |
+
``` cpp
|
| 193 |
+
c != b
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
*Effects:* Equivalent to `!(c == b)`.
|
| 197 |
+
|
| 198 |
+
``` cpp
|
| 199 |
+
t.swap(s)
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
*Result:* `void`.
|
| 203 |
+
|
| 204 |
+
*Effects:* Exchanges the contents of `t` and `s`.
|
| 205 |
+
|
| 206 |
+
*Complexity:* Linear for `array` and constant for all other standard
|
| 207 |
+
containers.
|
| 208 |
+
|
| 209 |
+
``` cpp
|
| 210 |
+
swap(t, s)
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
*Effects:* Equivalent to `t.swap(s)`.
|
| 214 |
+
|
| 215 |
+
``` cpp
|
| 216 |
+
c.size()
|
| 217 |
+
```
|
| 218 |
+
|
| 219 |
+
*Result:* `size_type`.
|
| 220 |
+
|
| 221 |
+
*Returns:* `distance(c.begin(), c.end())`, i.e., the number of elements
|
| 222 |
+
in the container.
|
| 223 |
+
|
| 224 |
+
*Complexity:* Constant.
|
| 225 |
+
|
| 226 |
+
*Remarks:* The number of elements is defined by the rules of
|
| 227 |
+
constructors, inserts, and erases.
|
| 228 |
+
|
| 229 |
+
``` cpp
|
| 230 |
+
c.max_size()
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
*Result:* `size_type`.
|
| 234 |
+
|
| 235 |
+
*Returns:* `distance(begin(), end())` for the largest possible
|
| 236 |
+
container.
|
| 237 |
+
|
| 238 |
+
*Complexity:* Constant.
|
| 239 |
+
|
| 240 |
+
``` cpp
|
| 241 |
+
c.empty()
|
| 242 |
+
```
|
| 243 |
+
|
| 244 |
+
*Result:* `bool`.
|
| 245 |
+
|
| 246 |
+
*Returns:* `c.begin() == c.end()`
|
| 247 |
+
|
| 248 |
+
*Complexity:* Constant.
|
| 249 |
+
|
| 250 |
+
*Remarks:* If the container is empty, then `c.empty()` is `true`.
|
| 251 |
+
|
| 252 |
+
In the expressions
|
| 253 |
+
|
| 254 |
+
``` cpp
|
| 255 |
+
i == j
|
| 256 |
+
i != j
|
| 257 |
+
i < j
|
| 258 |
+
i <= j
|
| 259 |
+
i >= j
|
| 260 |
+
i > j
|
| 261 |
+
i <=> j
|
| 262 |
+
i - j
|
| 263 |
+
```
|
| 264 |
+
|
| 265 |
+
where `i` and `j` denote objects of a container’s `iterator` type,
|
| 266 |
+
either or both may be replaced by an object of the container’s
|
| 267 |
+
`const_iterator` type referring to the same element with no change in
|
| 268 |
+
semantics.
|
| 269 |
+
|
| 270 |
+
Unless otherwise specified, all containers defined in this Clause obtain
|
| 271 |
+
memory using an allocator (see [[allocator.requirements]]).
|
| 272 |
+
|
| 273 |
+
[*Note 1*: In particular, containers and iterators do not store
|
| 274 |
+
references to allocated elements other than through the allocator’s
|
| 275 |
+
pointer type, i.e., as objects of type `P` or
|
| 276 |
+
`pointer_traits<P>::template rebind<unspecified>`, where `P` is
|
| 277 |
+
`allocator_traits<allocator_type>::pointer`. — *end note*]
|
| 278 |
+
|
| 279 |
+
Copy constructors for these container types obtain an allocator by
|
| 280 |
+
calling
|
| 281 |
+
`allocator_traits<allocator_type>::select_on_container_copy_construction`
|
| 282 |
+
on the allocator belonging to the container being copied. Move
|
| 283 |
+
constructors obtain an allocator by move construction from the allocator
|
| 284 |
+
belonging to the container being moved. Such move construction of the
|
| 285 |
+
allocator shall not exit via an exception. All other constructors for
|
| 286 |
+
these container types take a `const allocator_type&` argument.
|
| 287 |
+
|
| 288 |
+
[*Note 2*: If an invocation of a constructor uses the default value of
|
| 289 |
+
an optional allocator argument, then the allocator type must support
|
| 290 |
+
value-initialization. — *end note*]
|
| 291 |
+
|
| 292 |
+
A copy of this allocator is used for any memory allocation and element
|
| 293 |
+
construction performed, by these constructors and by all member
|
| 294 |
+
functions, during the lifetime of each container object or until the
|
| 295 |
+
allocator is replaced. The allocator may be replaced only via assignment
|
| 296 |
+
or `swap()`. Allocator replacement is performed by copy assignment, move
|
| 297 |
+
assignment, or swapping of the allocator only if
|
| 298 |
+
|
| 299 |
+
- `allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value`,
|
| 300 |
+
- `allocator_traits<allocator_type>::propagate_on_container_move_assignment::value`,
|
| 301 |
+
or
|
| 302 |
+
- `allocator_traits<allocator_type>::propagate_on_container_swap::value`
|
| 303 |
+
|
| 304 |
+
is `true` within the implementation of the corresponding container
|
| 305 |
+
operation. In all container types defined in this Clause, the member
|
| 306 |
+
`get_allocator()` returns a copy of the allocator used to construct the
|
| 307 |
+
container or, if that allocator has been replaced, a copy of the most
|
| 308 |
+
recent replacement.
|
| 309 |
+
|
| 310 |
+
The expression `a.swap(b)`, for containers `a` and `b` of a standard
|
| 311 |
+
container type other than `array`, shall exchange the values of `a` and
|
| 312 |
+
`b` without invoking any move, copy, or swap operations on the
|
| 313 |
+
individual container elements. Any `Compare`, `Pred`, or `Hash` types
|
| 314 |
+
belonging to `a` and `b` shall meet the *Cpp17Swappable* requirements
|
| 315 |
+
and shall be exchanged by calling `swap` as described in
|
| 316 |
+
[[swappable.requirements]]. If
|
| 317 |
+
`allocator_traits<allocator_type>::propagate_on_container_swap::value`
|
| 318 |
+
is `true`, then `allocator_type` shall meet the *Cpp17Swappable*
|
| 319 |
+
requirements and the allocators of `a` and `b` shall also be exchanged
|
| 320 |
+
by calling `swap` as described in [[swappable.requirements]].
|
| 321 |
+
Otherwise, the allocators shall not be swapped, and the behavior is
|
| 322 |
+
undefined unless `a.get_allocator() == b.get_allocator()`. Every
|
| 323 |
+
iterator referring to an element in one container before the swap shall
|
| 324 |
+
refer to the same element in the other container after the swap. It is
|
| 325 |
+
unspecified whether an iterator with value `a.end()` before the swap
|
| 326 |
+
will have value `b.end()` after the swap.
|
| 327 |
+
|
| 328 |
+
Unless otherwise specified (see [[associative.reqmts.except]],
|
| 329 |
+
[[unord.req.except]], [[deque.modifiers]], and [[vector.modifiers]]) all
|
| 330 |
+
container types defined in this Clause meet the following additional
|
| 331 |
+
requirements:
|
| 332 |
+
|
| 333 |
+
- If an exception is thrown by an `insert()` or `emplace()` function
|
| 334 |
+
while inserting a single element, that function has no effects.
|
| 335 |
+
- If an exception is thrown by a `push_back()`, `push_front()`,
|
| 336 |
+
`emplace_back()`, or `emplace_front()` function, that function has no
|
| 337 |
+
effects.
|
| 338 |
+
- No `erase()`, `clear()`, `pop_back()` or `pop_front()` function throws
|
| 339 |
+
an exception.
|
| 340 |
+
- No copy constructor or assignment operator of a returned iterator
|
| 341 |
+
throws an exception.
|
| 342 |
+
- No `swap()` function throws an exception.
|
| 343 |
+
- No `swap()` function invalidates any references, pointers, or
|
| 344 |
+
iterators referring to the elements of the containers being swapped.
|
| 345 |
+
\[*Note 3*: The `end()` iterator does not refer to any element, so it
|
| 346 |
+
can be invalidated. — *end note*]
|
| 347 |
+
|
| 348 |
+
Unless otherwise specified (either explicitly or by defining a function
|
| 349 |
+
in terms of other functions), invoking a container member function or
|
| 350 |
+
passing a container as an argument to a library function shall not
|
| 351 |
+
invalidate iterators to, or change the values of, objects within that
|
| 352 |
+
container.
|
| 353 |
+
|
| 354 |
+
A *contiguous container* is a container whose member types `iterator`
|
| 355 |
+
and `const_iterator` meet the *Cpp17RandomAccessIterator* requirements
|
| 356 |
+
[[random.access.iterators]] and model `contiguous_iterator`
|
| 357 |
+
[[iterator.concept.contiguous]].
|
| 358 |
+
|
| 359 |
+
The behavior of certain container member functions and deduction guides
|
| 360 |
+
depends on whether types qualify as input iterators or allocators. The
|
| 361 |
+
extent to which an implementation determines that a type cannot be an
|
| 362 |
+
input iterator is unspecified, except that as a minimum integral types
|
| 363 |
+
shall not qualify as input iterators. Likewise, the extent to which an
|
| 364 |
+
implementation determines that a type cannot be an allocator is
|
| 365 |
+
unspecified, except that as a minimum a type `A` shall not qualify as an
|
| 366 |
+
allocator unless it meets both of the following conditions:
|
| 367 |
+
|
| 368 |
+
- The *qualified-id* `A::value_type` is valid and denotes a type
|
| 369 |
+
[[temp.deduct]].
|
| 370 |
+
- The expression `declval<A&>().allocate(size_t{})` is well-formed when
|
| 371 |
+
treated as an unevaluated operand.
|
| 372 |
+
|