From Jason Turner

[associative.reqmts.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvk6jkooo/{from.md → to.md} +823 -0
tmp/tmpvk6jkooo/{from.md → to.md} RENAMED
@@ -0,0 +1,823 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### General <a id="associative.reqmts.general">[[associative.reqmts.general]]</a>
2
+
3
+ Associative containers provide fast retrieval of data based on keys. The
4
+ library provides four basic kinds of associative containers: `set`,
5
+ `multiset`, `map` and `multimap`. The library also provides container
6
+ adaptors that make it easy to construct abstract data types, such as
7
+ `flat_map`s, `flat_multimap`s, `flat_set`s, or `flat_multiset`s, out of
8
+ the basic sequence container kinds (or out of other program-defined
9
+ sequence containers).
10
+
11
+ Each associative container is parameterized on `Key` and an ordering
12
+ relation `Compare` that induces a strict weak ordering [[alg.sorting]]
13
+ on elements of `Key`. In addition, `map` and `multimap` associate an
14
+ arbitrary *mapped type* `T` with the `Key`. The object of type `Compare`
15
+ is called the *comparison object* of a container.
16
+
17
+ The phrase “equivalence of keys” means the equivalence relation imposed
18
+ by the comparison object. That is, two keys `k1` and `k2` are considered
19
+ to be equivalent if for the comparison object `comp`,
20
+ `comp(k1, k2) == false && comp(k2, k1) == false`.
21
+
22
+ [*Note 1*: This is not necessarily the same as the result of
23
+ `k1 == k2`. — *end note*]
24
+
25
+ For any two keys `k1` and `k2` in the same container, calling
26
+ `comp(k1, k2)` shall always return the same value.
27
+
28
+ An associative container supports *unique keys* if it may contain at
29
+ most one element for each key. Otherwise, it supports *equivalent keys*.
30
+ The `set` and `map` classes support unique keys; the `multiset` and
31
+ `multimap` classes support equivalent keys. For `multiset` and
32
+ `multimap`, `insert`, `emplace`, and `erase` preserve the relative
33
+ ordering of equivalent elements.
34
+
35
+ For `set` and `multiset` the value type is the same as the key type. For
36
+ `map` and `multimap` it is equal to `pair<const Key, T>`.
37
+
38
+ `iterator`
39
+
40
+ of an associative container is of the bidirectional iterator category.
41
+ For associative containers where the value type is the same as the key
42
+ type, both `iterator` and `const_iterator` are constant iterators. It is
43
+ unspecified whether or not `iterator` and `const_iterator` are the same
44
+ type.
45
+
46
+ [*Note 2*: `iterator` and `const_iterator` have identical semantics in
47
+ this case, and `iterator` is convertible to `const_iterator`. Users can
48
+ avoid violating the one-definition rule by always using `const_iterator`
49
+ in their function parameter lists. — *end note*]
50
+
51
+ In this subclause,
52
+
53
+ - `X` denotes an associative container class,
54
+ - `a` denotes a value of type `X`,
55
+ - `a2` denotes a value of a type with nodes compatible with type `X` (
56
+ [[container.node.compat]]),
57
+ - `b` denotes a value or type `X` or `const X`,
58
+ - `u` denotes the name of a variable being declared,
59
+ - `a_uniq` denotes a value of type `X` when `X` supports unique keys,
60
+ - `a_eq` denotes a value of type `X` when `X` supports multiple keys,
61
+ - `a_tran` denotes a value of type `X` or `const X` when the
62
+ *qualified-id* `X::key_compare::is_transparent` is valid and denotes a
63
+ type [[temp.deduct]],
64
+ - `i` and `j` meet the *Cpp17InputIterator* requirements and refer to
65
+ elements implicitly convertible to `value_type`,
66
+ - \[`i`, `j`) denotes a valid range,
67
+ - `rg` denotes a value of a type `R` that models
68
+ `container-compatible-range<value_type>`,
69
+ - `p` denotes a valid constant iterator to `a`,
70
+ - `q` denotes a valid dereferenceable constant iterator to `a`,
71
+ - `r` denotes a valid dereferenceable iterator to `a`,
72
+ - `[q1, q2)` denotes a valid range of constant iterators in `a`,
73
+ - `il` designates an object of type `initializer_list<value_type>`,
74
+ - `t` denotes a value of type `X::value_type`,
75
+ - `k` denotes a value of type `X::key_type`, and
76
+ - `c` denotes a value of type `X::key_compare` or
77
+ `const X::key_compare`;
78
+ - `kl` is a value such that `a` is partitioned [[alg.sorting]] with
79
+ respect to `c(x, kl)`, with `x` the key value of `e` and `e` in `a`;
80
+ - `ku` is a value such that `a` is partitioned with respect to
81
+ `!c(ku, x)`, with `x` the key value of `e` and `e` in `a`;
82
+ - `ke` is a value such that `a` is partitioned with respect to
83
+ `c(x, ke)` and `!c(ke, x)`, with `c(x, ke)` implying `!c(ke, x)` and
84
+ with `x` the key value of `e` and `e` in `a`;
85
+ - `kx` is a value such that
86
+ - `a` is partitioned with respect to `c(x, kx)` and `!c(kx, x)`, with
87
+ `c(x, kx)` implying `!c(kx, x)` and with `x` the key value of `e`
88
+ and `e` in `a`, and
89
+ - `kx` is not convertible to either `iterator` or `const_iterator`;
90
+ and
91
+ - `A` denotes the storage allocator used by `X`, if any, or
92
+ `allocator<X::value_type>` otherwise,
93
+ - `m` denotes an allocator of a type convertible to `A`, and `nh`
94
+ denotes a non-const rvalue of type `X::node_type`.
95
+
96
+ A type `X` meets the *associative container* requirements if `X` meets
97
+ all the requirements of an allocator-aware container
98
+ [[container.requirements.general]] and the following types, statements,
99
+ and expressions are well-formed and have the specified semantics, except
100
+ that for `map` and `multimap`, the requirements placed on `value_type`
101
+ in [[container.alloc.reqmts]] apply instead to `key_type` and
102
+ `mapped_type`.
103
+
104
+ [*Note 3*: For example, in some cases `key_type` and `mapped_type` are
105
+ required to be *Cpp17CopyAssignable* even though the associated
106
+ `value_type`, `pair<const key_type, mapped_type>`, is not
107
+ *Cpp17CopyAssignable*. — *end note*]
108
+
109
+ ``` cpp
110
+ typename X::key_type
111
+ ```
112
+
113
+ *Result:* `Key`.
114
+
115
+ ``` cpp
116
+ typename X::mapped_type
117
+ ```
118
+
119
+ *Result:* `T`.
120
+
121
+ *Remarks:* For `map` and `multimap` only.
122
+
123
+ ``` cpp
124
+ typename X::value_type
125
+ ```
126
+
127
+ *Result:* `Key` for `set` and `multiset` only; `pair<const Key, T>` for
128
+ `map` and `multimap` only.
129
+
130
+ *Preconditions:* `X::value_type` is *Cpp17Erasable* from `X`.
131
+
132
+ ``` cpp
133
+ typename X::key_compare
134
+ ```
135
+
136
+ *Result:* `Compare`.
137
+
138
+ *Preconditions:* `key_compare` is *Cpp17CopyConstructible*.
139
+
140
+ ``` cpp
141
+ typename X::value_compare
142
+ ```
143
+
144
+ *Result:* A binary predicate type. It is the same as `key_compare` for
145
+ `set` and `multiset`; is an ordering relation on pairs induced by the
146
+ first component (i.e., `Key`) for `map` and `multimap`.
147
+
148
+ ``` cpp
149
+ typename X::node_type
150
+ ```
151
+
152
+ *Result:* A specialization of the *node-handle* class
153
+ template [[container.node]], such that the public nested types are the
154
+ same types as the corresponding types in `X`.
155
+
156
+ ``` cpp
157
+ X(c)
158
+ ```
159
+
160
+ *Effects:* Constructs an empty container. Uses a copy of `c` as a
161
+ comparison object.
162
+
163
+ *Complexity:* Constant.
164
+
165
+ ``` cpp
166
+ X u = X();
167
+ X u;
168
+ ```
169
+
170
+ *Preconditions:* `key_compare` meets the *Cpp17DefaultConstructible*
171
+ requirements.
172
+
173
+ *Effects:* Constructs an empty container. Uses `Compare()` as a
174
+ comparison object.
175
+
176
+ *Complexity:* Constant.
177
+
178
+ ``` cpp
179
+ X(i, j, c)
180
+ ```
181
+
182
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
183
+ from `*i`.
184
+
185
+ *Effects:* Constructs an empty container and inserts elements from the
186
+ range \[`i`, `j`) into it; uses `c` as a comparison object.
187
+
188
+ *Complexity:* N log N in general, where N has the value
189
+ `distance(i, j)`; linear if \[`i`, `j`) is sorted with respect to
190
+ `value_comp()`.
191
+
192
+ ``` cpp
193
+ X(i, j)
194
+ ```
195
+
196
+ *Preconditions:* `key_compare` meets the *Cpp17DefaultConstructible*
197
+ requirements. `value_type` is *Cpp17EmplaceConstructible* into `X` from
198
+ `*i`.
199
+
200
+ *Effects:* Constructs an empty container and inserts elements from the
201
+ range \[`i`, `j`) into it; uses `Compare()` as a comparison object.
202
+
203
+ *Complexity:* N log N in general, where N has the value
204
+ `distance(i, j)`; linear if \[`i`, `j`) is sorted with respect to
205
+ `value_comp()`.
206
+
207
+ ``` cpp
208
+ X(from_range, rg, c)
209
+ ```
210
+
211
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
212
+ from `*ranges::begin(rg)`.
213
+
214
+ *Effects:* Constructs an empty container and inserts each element from
215
+ `rg` into it. Uses `c` as the comparison object.
216
+
217
+ *Complexity:* N log N in general, where N has the value
218
+ `ranges::distance(rg)`; linear if `rg` is sorted with respect to
219
+ `value_comp()`.
220
+
221
+ ``` cpp
222
+ X(from_range, rg)
223
+ ```
224
+
225
+ *Preconditions:* `key_compare` meets the *Cpp17DefaultConstructible*
226
+ requirements. `value_type` is *Cpp17EmplaceConstructible* into `X` from
227
+ `*ranges::begin(rg)`.
228
+
229
+ *Effects:* Constructs an empty container and inserts each element from
230
+ `rg` into it. Uses `Compare()` as the comparison object.
231
+
232
+ *Complexity:* Same as `X(from_range, rg, c)`.
233
+
234
+ ``` cpp
235
+ X(il, c)
236
+ ```
237
+
238
+ *Effects:* Equivalent to `X(il.begin(), il.end(), c)`.
239
+
240
+ ``` cpp
241
+ X(il)
242
+ ```
243
+
244
+ *Effects:* Equivalent to `X(il.begin(), il.end())`.
245
+
246
+ ``` cpp
247
+ a = il
248
+ ```
249
+
250
+ *Result:* `X&`
251
+
252
+ *Preconditions:* `value_type` is *Cpp17CopyInsertable* into `X` and
253
+ *Cpp17CopyAssignable*.
254
+
255
+ *Effects:* Assigns the range \[`il.begin()`, `il.end()`) into `a`. All
256
+ existing elements of `a` are either assigned to or destroyed.
257
+
258
+ *Complexity:* N log N in general, where N has the value
259
+ `il.size() + a.size()`; linear if \[`il.begin()`, `il.end()`) is sorted
260
+ with respect to `value_comp()`.
261
+
262
+ ``` cpp
263
+ b.key_comp()
264
+ ```
265
+
266
+ *Result:* `X::key_compare`
267
+
268
+ *Returns:* The comparison object out of which `b` was constructed.
269
+
270
+ *Complexity:* Constant.
271
+
272
+ ``` cpp
273
+ b.value_comp()
274
+ ```
275
+
276
+ *Result:* `X::value_compare`
277
+
278
+ *Returns:* An object of `value_compare` constructed out of the
279
+ comparison object.
280
+
281
+ *Complexity:* Constant.
282
+
283
+ ``` cpp
284
+ a_uniq.emplace(args)
285
+ ```
286
+
287
+ *Result:* `pair<iterator, bool>`
288
+
289
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
290
+ from `args`.
291
+
292
+ *Effects:* Inserts a `value_type` object `t` constructed with
293
+ `std::forward<Args>(args)...` if and only if there is no element in the
294
+ container with key equivalent to the key of `t`.
295
+
296
+ *Returns:* The `bool` component of the returned pair is `true` if and
297
+ only if the insertion takes place, and the iterator component of the
298
+ pair points to the element with key equivalent to the key of `t`.
299
+
300
+ *Complexity:* Logarithmic.
301
+
302
+ ``` cpp
303
+ a_eq.emplace(args)
304
+ ```
305
+
306
+ *Result:* `iterator`
307
+
308
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
309
+ from `args`.
310
+
311
+ *Effects:* Inserts a `value_type` object `t` constructed with
312
+ `std::forward<Args>(args)...`. If a range containing elements equivalent
313
+ to `t` exists in `a_eq`, `t` is inserted at the end of that range.
314
+
315
+ *Returns:* An iterator pointing to the newly inserted element.
316
+
317
+ *Complexity:* Logarithmic.
318
+
319
+ ``` cpp
320
+ a.emplace_hint(p, args)
321
+ ```
322
+
323
+ *Result:* `iterator`
324
+
325
+ *Effects:* Equivalent to `a.emplace(std::forward<Args>(args)...)`,
326
+ except that the element is inserted as close as possible to the position
327
+ just prior to `p`.
328
+
329
+ *Returns:* An iterator pointing to the element with the key equivalent
330
+ to the newly inserted element.
331
+
332
+ *Complexity:* Logarithmic in general, but amortized constant if the
333
+ element is inserted right before `p`.
334
+
335
+ ``` cpp
336
+ a_uniq.insert(t)
337
+ ```
338
+
339
+ *Result:* `pair<iterator, bool>`
340
+
341
+ *Preconditions:* If `t` is a non-const rvalue, `value_type` is
342
+ *Cpp17MoveInsertable* into `X`; otherwise, `value_type` is
343
+ *Cpp17CopyInsertable* into `X`.
344
+
345
+ *Effects:* Inserts `t` if and only if there is no element in the
346
+ container with key equivalent to the key of `t`.
347
+
348
+ *Returns:* The `bool` component of the returned pair is `true` if and
349
+ only if the insertion takes place, and the `iterator` component of the
350
+ pair points to the element with key equivalent to the key of `t`.
351
+
352
+ *Complexity:* Logarithmic.
353
+
354
+ ``` cpp
355
+ a_eq.insert(t)
356
+ ```
357
+
358
+ *Result:* `iterator`
359
+
360
+ *Preconditions:* If `t` is a non-const rvalue, `value_type` is
361
+ *Cpp17MoveInsertable* into `X`; otherwise, `value_type` is
362
+ *Cpp17CopyInsertable* into `X`.
363
+
364
+ *Effects:* Inserts `t` and returns the iterator pointing to the newly
365
+ inserted element. If a range containing elements equivalent to `t`
366
+ exists in `a_eq`, `t` is inserted at the end of that range.
367
+
368
+ *Complexity:* Logarithmic.
369
+
370
+ ``` cpp
371
+ a.insert(p, t)
372
+ ```
373
+
374
+ *Result:* `iterator`
375
+
376
+ *Preconditions:* If `t` is a non-const rvalue, `value_type` is
377
+ *Cpp17MoveInsertable* into `X`; otherwise, `value_type` is
378
+ *Cpp17CopyInsertable* into `X`.
379
+
380
+ *Effects:* Inserts `t` if and only if there is no element with key
381
+ equivalent to the key of `t` in containers with unique keys; always
382
+ inserts `t` in containers with equivalent keys. `t` is inserted as close
383
+ as possible to the position just prior to `p`.
384
+
385
+ *Returns:* An iterator pointing to the element with key equivalent to
386
+ the key of `t`.
387
+
388
+ *Complexity:* Logarithmic in general, but amortized constant if `t` is
389
+ inserted right before `p`.
390
+
391
+ ``` cpp
392
+ a.insert(i, j)
393
+ ```
394
+
395
+ *Result:* `void`
396
+
397
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
398
+ from `*i`. Neither `i` nor `j` are iterators into `a`.
399
+
400
+ *Effects:* Inserts each element from the range \[`i`, `j`) if and only
401
+ if there is no element with key equivalent to the key of that element in
402
+ containers with unique keys; always inserts that element in containers
403
+ with equivalent keys.
404
+
405
+ *Complexity:* N log (`a.size()` + N), where N has the value
406
+ `distance(i, j)`.
407
+
408
+ ``` cpp
409
+ a.insert_range(rg)
410
+ ```
411
+
412
+ *Result:* `void`
413
+
414
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
415
+ from `*ranges::begin(rg)`. `rg` and `a` do not overlap.
416
+
417
+ *Effects:* Inserts each element from `rg` if and only if there is no
418
+ element with key equivalent to the key of that element in containers
419
+ with unique keys; always inserts that element in containers with
420
+ equivalent keys.
421
+
422
+ *Complexity:* N log (`a.size()` + N), where N has the value
423
+ `ranges::distance(rg)`.
424
+
425
+ ``` cpp
426
+ a.insert(il)
427
+ ```
428
+
429
+ *Effects:* Equivalent to `a.insert(il.begin(), il.end())`.
430
+
431
+ ``` cpp
432
+ a_uniq.insert(nh)
433
+ ```
434
+
435
+ *Result:* `insert_return_type`
436
+
437
+ *Preconditions:* `nh` is empty or
438
+ `a_uniq.get_allocator() == nh.get_allocator()` is `true`.
439
+
440
+ *Effects:* If `nh` is empty, has no effect. Otherwise, inserts the
441
+ element owned by `nh` if and only if there is no element in the
442
+ container with a key equivalent to `nh.key()`.
443
+
444
+ *Returns:* If `nh` is empty, `inserted` is `false`, `position` is
445
+ `end()`, and `node` is empty. Otherwise if the insertion took place,
446
+ `inserted` is `true`, `position` points to the inserted element, and
447
+ `node` is empty; if the insertion failed, `inserted` is `false`, `node`
448
+ has the previous value of `nh`, and `position` points to an element with
449
+ a key equivalent to `nh.key()`.
450
+
451
+ *Complexity:* Logarithmic.
452
+
453
+ ``` cpp
454
+ a_eq.insert(nh)
455
+ ```
456
+
457
+ *Result:* `iterator`
458
+
459
+ *Preconditions:* `nh` is empty or
460
+ `a_eq.get_allocator() == nh.get_allocator()` is `true`.
461
+
462
+ *Effects:* If `nh` is empty, has no effect and returns `a_eq.end()`.
463
+ Otherwise, inserts the element owned by `nh` and returns an iterator
464
+ pointing to the newly inserted element. If a range containing elements
465
+ with keys equivalent to `nh.key()` exists in `a_eq`, the element is
466
+ inserted at the end of that range.
467
+
468
+ *Ensures:* `nh` is empty.
469
+
470
+ *Complexity:* Logarithmic.
471
+
472
+ ``` cpp
473
+ a.insert(p, nh)
474
+ ```
475
+
476
+ *Result:* `iterator`
477
+
478
+ *Preconditions:* `nh` is empty or
479
+ `a.get_allocator() == nh.get_allocator()` is `true`.
480
+
481
+ *Effects:* If `nh` is empty, has no effect and returns `a.end()`.
482
+ Otherwise, inserts the element owned by `nh` if and only if there is no
483
+ element with key equivalent to `nh.key()` in containers with unique
484
+ keys; always inserts the element owned by `nh` in containers with
485
+ equivalent keys. The element is inserted as close as possible to the
486
+ position just prior to `p`.
487
+
488
+ *Ensures:* `nh` is empty if insertion succeeds, unchanged if insertion
489
+ fails.
490
+
491
+ *Returns:* An iterator pointing to the element with key equivalent to
492
+ `nh.key()`.
493
+
494
+ *Complexity:* Logarithmic in general, but amortized constant if the
495
+ element is inserted right before `p`.
496
+
497
+ ``` cpp
498
+ a.extract(k)
499
+ ```
500
+
501
+ *Result:* `node_type`
502
+
503
+ *Effects:* Removes the first element in the container with key
504
+ equivalent to `k`.
505
+
506
+ *Returns:* A `node_type` owning the element if found, otherwise an empty
507
+ `node_type`.
508
+
509
+ *Complexity:* log (`a.size()`)
510
+
511
+ ``` cpp
512
+ a_tran.extract(kx)
513
+ ```
514
+
515
+ *Result:* `node_type`
516
+
517
+ *Effects:* Removes the first element in the container with key `r` such
518
+ that `!c(r, kx) && !c(kx, r)` is `true`.
519
+
520
+ *Returns:* A `node_type` owning the element if found, otherwise an empty
521
+ `node_type`.
522
+
523
+ *Complexity:* log(`a_tran.size()`)
524
+
525
+ ``` cpp
526
+ a.extract(q)
527
+ ```
528
+
529
+ *Result:* `node_type`
530
+
531
+ *Effects:* Removes the element pointed to by `q`.
532
+
533
+ *Returns:* A `node_type` owning that element.
534
+
535
+ *Complexity:* Amortized constant.
536
+
537
+ ``` cpp
538
+ a.merge(a2)
539
+ ```
540
+
541
+ *Result:* `void`
542
+
543
+ *Preconditions:* `a.get_allocator() == a2.get_allocator()`.
544
+
545
+ *Effects:* Attempts to extract each element in `a2` and insert it into
546
+ `a` using the comparison object of `a`. In containers with unique keys,
547
+ if there is an element in `a` with key equivalent to the key of an
548
+ element from `a2`, then that element is not extracted from `a2`.
549
+
550
+ *Ensures:* Pointers and references to the transferred elements of `a2`
551
+ refer to those same elements but as members of `a`. Iterators referring
552
+ to the transferred elements will continue to refer to their elements,
553
+ but they now behave as iterators into `a`, not into `a2`.
554
+
555
+ *Throws:* Nothing unless the comparison object throws.
556
+
557
+ *Complexity:* N log(`a.size()+` N), where N has the value `a2.size()`.
558
+
559
+ ``` cpp
560
+ a.erase(k)
561
+ ```
562
+
563
+ *Result:* `size_type`
564
+
565
+ *Effects:* Erases all elements in the container with key equivalent to
566
+ `k`.
567
+
568
+ *Returns:* The number of erased elements.
569
+
570
+ *Complexity:* log (`a.size()`) + `a.count(k)`
571
+
572
+ ``` cpp
573
+ a_tran.erase(kx)
574
+ ```
575
+
576
+ *Result:* `size_type`
577
+
578
+ *Effects:* Erases all elements in the container with key `r` such that
579
+ `!c(r, kx) && !c(kx, r)` is `true`.
580
+
581
+ *Returns:* The number of erased elements.
582
+
583
+ *Complexity:* log(`a_tran.size())` + `a_tran.count(kx)`
584
+
585
+ ``` cpp
586
+ a.erase(q)
587
+ ```
588
+
589
+ *Result:* `iterator`
590
+
591
+ *Effects:* Erases the element pointed to by `q`.
592
+
593
+ *Returns:* An iterator pointing to the element immediately following `q`
594
+ prior to the element being erased. If no such element exists, returns
595
+ `a.end()`.
596
+
597
+ *Complexity:* Amortized constant.
598
+
599
+ ``` cpp
600
+ a.erase(r)
601
+ ```
602
+
603
+ *Result:* `iterator`
604
+
605
+ *Effects:* Erases the element pointed to by `r`.
606
+
607
+ *Returns:* An iterator pointing to the element immediately following `r`
608
+ prior to the element being erased. If no such element exists, returns
609
+ `a.end()`.
610
+
611
+ *Complexity:* Amortized constant.
612
+
613
+ ``` cpp
614
+ a.erase(q1, q2)
615
+ ```
616
+
617
+ *Result:* `iterator`
618
+
619
+ *Effects:* Erases all the elements in the range \[`q1`, `q2`).
620
+
621
+ *Returns:* An iterator pointing to the element pointed to by `q2` prior
622
+ to any elements being erased. If no such element exists, `a.end()` is
623
+ returned.
624
+
625
+ *Complexity:* log(`a.size()`) + N, where N has the value
626
+ `distance(q1, q2)`.
627
+
628
+ ``` cpp
629
+ a.clear()
630
+ ```
631
+
632
+ *Effects:* Equivalent to `a.erase(a.begin(), a.end())`.
633
+
634
+ *Ensures:* `a.empty()` is `true`.
635
+
636
+ *Complexity:* Linear in `a.size()`.
637
+
638
+ ``` cpp
639
+ b.find(k)
640
+ ```
641
+
642
+ *Result:* `iterator`; `const_iterator` for constant `b`.
643
+
644
+ *Returns:* An iterator pointing to an element with the key equivalent to
645
+ `k`, or `b.end()` if such an element is not found.
646
+
647
+ *Complexity:* Logarithmic.
648
+
649
+ ``` cpp
650
+ a_tran.find(ke)
651
+ ```
652
+
653
+ *Result:* `iterator`; `const_iterator` for constant `a_tran`.
654
+
655
+ *Returns:* An iterator pointing to an element with key `r` such that
656
+ `!c(r, ke) && !c(ke, r)` is `true`, or `a_tran.end()` if such an element
657
+ is not found.
658
+
659
+ *Complexity:* Logarithmic.
660
+
661
+ ``` cpp
662
+ b.count(k)
663
+ ```
664
+
665
+ *Result:* `size_type`
666
+
667
+ *Returns:* The number of elements with key equivalent to `k`.
668
+
669
+ *Complexity:* log (`b.size()`) + `b.count(k)`
670
+
671
+ ``` cpp
672
+ a_tran.count(ke)
673
+ ```
674
+
675
+ *Result:* `size_type`
676
+
677
+ *Returns:* The number of elements with key `r` such that
678
+ `!c(r, ke) && !c(ke, r)`.
679
+
680
+ *Complexity:* log (`a_tran.size()`) + `a_tran.count(ke)`
681
+
682
+ ``` cpp
683
+ b.contains(k)
684
+ ```
685
+
686
+ *Result:* `bool`
687
+
688
+ *Effects:* Equivalent to: `return b.find(k) != b.end();`
689
+
690
+ ``` cpp
691
+ a_tran.contains(ke)
692
+ ```
693
+
694
+ *Result:* `bool`
695
+
696
+ *Effects:* Equivalent to: `return a_tran.find(ke) != a_tran.end();`
697
+
698
+ ``` cpp
699
+ b.lower_bound(k)
700
+ ```
701
+
702
+ *Result:* `iterator`; `const_iterator` for constant `b`.
703
+
704
+ *Returns:* An iterator pointing to the first element with key not less
705
+ than `k`, or `b.end()` if such an element is not found.
706
+
707
+ *Complexity:* Logarithmic.
708
+
709
+ ``` cpp
710
+ a_tran.lower_bound(kl)
711
+ ```
712
+
713
+ *Result:* `iterator`; `const_iterator` for constant `a_tran`.
714
+
715
+ *Returns:* An iterator pointing to the first element with key `r` such
716
+ that `!c(r, kl)`, or `a_tran.end()` if such an element is not found.
717
+
718
+ *Complexity:* Logarithmic.
719
+
720
+ ``` cpp
721
+ b.upper_bound(k)
722
+ ```
723
+
724
+ *Result:* `iterator`; `const_iterator` for constant `b`.
725
+
726
+ *Returns:* An iterator pointing to the first element with key greater
727
+ than `k`, or `b.end()` if such an element is not found.
728
+
729
+ *Complexity:* Logarithmic,
730
+
731
+ ``` cpp
732
+ a_tran.upper_bound(ku)
733
+ ```
734
+
735
+ *Result:* `iterator`; `const_iterator` for constant `a_tran`.
736
+
737
+ *Returns:* An iterator pointing to the first element with key `r` such
738
+ that `c(ku, r)`, or `a_tran.end()` if such an element is not found.
739
+
740
+ *Complexity:* Logarithmic.
741
+
742
+ ``` cpp
743
+ b.equal_range(k)
744
+ ```
745
+
746
+ *Result:* `pair<iterator, iterator>`;
747
+ `pair<const_iterator, const_iterator>` for constant `b`.
748
+
749
+ *Effects:* Equivalent to:
750
+ `return make_pair(b.lower_bound(k), b.upper_bound(k));`
751
+
752
+ *Complexity:* Logarithmic.
753
+
754
+ ``` cpp
755
+ a_tran.equal_range(ke)
756
+ ```
757
+
758
+ *Result:* `pair<iterator, iterator>`;
759
+ `pair<const_iterator, const_iterator>` for constant `a_tran`.
760
+
761
+ *Effects:* Equivalent to:
762
+ `return make_pair(a_tran.lower_bound(ke), a_tran.upper_bound(ke));`
763
+
764
+ *Complexity:* Logarithmic.
765
+
766
+ The `insert`, `insert_range`, and `emplace` members shall not affect the
767
+ validity of iterators and references to the container, and the `erase`
768
+ members shall invalidate only iterators and references to the erased
769
+ elements.
770
+
771
+ The `extract` members invalidate only iterators to the removed element;
772
+ pointers and references to the removed element remain valid. However,
773
+ accessing the element through such pointers and references while the
774
+ element is owned by a `node_type` is undefined behavior. References and
775
+ pointers to an element obtained while it is owned by a `node_type` are
776
+ invalidated if the element is successfully inserted.
777
+
778
+ The fundamental property of iterators of associative containers is that
779
+ they iterate through the containers in the non-descending order of keys
780
+ where non-descending is defined by the comparison that was used to
781
+ construct them. For any two dereferenceable iterators `i` and `j` such
782
+ that distance from `i` to `j` is positive, the following condition
783
+ holds:
784
+
785
+ ``` cpp
786
+ value_comp(*j, *i) == false
787
+ ```
788
+
789
+ For associative containers with unique keys the stronger condition
790
+ holds:
791
+
792
+ ``` cpp
793
+ value_comp(*i, *j) != false
794
+ ```
795
+
796
+ When an associative container is constructed by passing a comparison
797
+ object the container shall not store a pointer or reference to the
798
+ passed object, even if that object is passed by reference. When an
799
+ associative container is copied, through either a copy constructor or an
800
+ assignment operator, the target container shall then use the comparison
801
+ object from the container being copied, as if that comparison object had
802
+ been passed to the target container in its constructor.
803
+
804
+ The member function templates `find`, `count`, `contains`,
805
+ `lower_bound`, `upper_bound`, `equal_range`, `erase`, and `extract`
806
+ shall not participate in overload resolution unless the *qualified-id*
807
+ `Compare::is_transparent` is valid and denotes a type [[temp.deduct]].
808
+ Additionally, the member function templates `extract` and `erase` shall
809
+ not participate in overload resolution if
810
+ `is_convertible_v<K&&, iterator> || is_convertible_v<K&&, const_iterator>`
811
+ is `true`, where `K` is the type substituted as the first template
812
+ argument.
813
+
814
+ A deduction guide for an associative container shall not participate in
815
+ overload resolution if any of the following are true:
816
+
817
+ - It has an `InputIterator` template parameter and a type that does not
818
+ qualify as an input iterator is deduced for that parameter.
819
+ - It has an `Allocator` template parameter and a type that does not
820
+ qualify as an allocator is deduced for that parameter.
821
+ - It has a `Compare` template parameter and a type that qualifies as an
822
+ allocator is deduced for that parameter.
823
+