From Jason Turner

[container.adaptors.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpncckbnvr/{from.md → to.md} +63 -16
tmp/tmpncckbnvr/{from.md → to.md} RENAMED
@@ -1,32 +1,79 @@
1
  ### In general <a id="container.adaptors.general">[[container.adaptors.general]]</a>
2
 
3
- The headers `<queue>` and `<stack>` define the container adaptors
4
- `queue`, `priority_queue`, and `stack`.
 
5
 
6
- The container adaptors each take a `Container` template parameter, and
7
- each constructor takes a `Container` reference argument. This container
8
- is copied into the `Container` member of each adaptor. If the container
9
- takes an allocator, then a compatible allocator may be passed in to the
10
- adaptor’s constructor. Otherwise, normal copy or move construction is
11
- used for the container argument. The first template parameter `T` of the
12
- container adaptors shall denote the same type as
13
- `Container::value_type`.
 
 
 
 
14
 
15
  For container adaptors, no `swap` function throws an exception unless
16
- that exception is thrown by the swap of the adaptor’s `Container` or
17
- `Compare` object (if any).
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  A deduction guide for a container adaptor shall not participate in
20
  overload resolution if any of the following are true:
21
 
22
  - It has an `InputIterator` template parameter and a type that does not
23
  qualify as an input iterator is deduced for that parameter.
24
  - It has a `Compare` template parameter and a type that qualifies as an
25
  allocator is deduced for that parameter.
26
- - It has a `Container` template parameter and a type that qualifies as
27
- an allocator is deduced for that parameter.
28
- - It has an `Allocator` template parameter and a type that does not
29
- qualify as an allocator is deduced for that parameter.
 
 
30
  - It has both `Container` and `Allocator` template parameters, and
31
  `uses_allocator_v<Container, Allocator>` is `false`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
 
1
  ### In general <a id="container.adaptors.general">[[container.adaptors.general]]</a>
2
 
3
+ The headers `<queue>`, `<stack>`, `<flat_map>`, and `<flat_set>` define
4
+ the container adaptors `queue` and `priority_queue`, `stack`, `flat_map`
5
+ and `flat_multimap`, and `flat_set` and `flat_multiset`, respectively.
6
 
7
+ Each container adaptor takes one or more template parameters named
8
+ `Container`, `KeyContainer`, or `MappedContainer` that denote the types
9
+ of containers that the container adaptor adapts. Each container adaptor
10
+ has at least one constructor that takes a reference argument to one or
11
+ more such template parameters. For each constructor reference argument
12
+ to a container `C`, the constructor copies the container into the
13
+ container adaptor. If `C` takes an allocator, then a compatible
14
+ allocator may be passed in to the adaptor’s constructor. Otherwise,
15
+ normal copy or move construction is used for the container argument. For
16
+ the container adaptors that take a single container template parameter
17
+ `Container`, the first template parameter `T` of the container adaptor
18
+ shall denote the same type as `Container::value_type`.
19
 
20
  For container adaptors, no `swap` function throws an exception unless
21
+ that exception is thrown by the swap of the adaptor’s `Container`,
22
+ `KeyContainer`, `MappedContainer`, or `Compare` object (if any).
23
+
24
+ A constructor template of a container adaptor shall not participate in
25
+ overload resolution if it has an `InputIterator` template parameter and
26
+ a type that does not qualify as an input iterator is deduced for that
27
+ parameter.
28
+
29
+ For container adaptors that have them, the `insert`, `emplace`, and
30
+ `erase` members affect the validity of iterators, references, and
31
+ pointers to the adaptor’s container(s) in the same way that the
32
+ containers’ respective `insert`, `emplace`, and `erase` members do.
33
+
34
+ [*Example 1*: A call to `flat_map<Key, T>::insert` can invalidate all
35
+ iterators to the `flat_map`. — *end example*]
36
 
37
  A deduction guide for a container adaptor shall not participate in
38
  overload resolution if any of the following are true:
39
 
40
  - It has an `InputIterator` template parameter and a type that does not
41
  qualify as an input iterator is deduced for that parameter.
42
  - It has a `Compare` template parameter and a type that qualifies as an
43
  allocator is deduced for that parameter.
44
+ - It has a `Container`, `KeyContainer`, or `MappedContainer` template
45
+ parameter and a type that qualifies as an allocator is deduced for
46
+ that parameter.
47
+ - It has no `Container`, `KeyContainer`, or `MappedContainer` template
48
+ parameter, and it has an `Allocator` template parameter, and a type
49
+ that does not qualify as an allocator is deduced for that parameter.
50
  - It has both `Container` and `Allocator` template parameters, and
51
  `uses_allocator_v<Container, Allocator>` is `false`.
52
+ - It has both `KeyContainer` and `Allocator` template parameters, and
53
+ `uses_allocator_v<KeyContainer, Allocator>` is `false`.
54
+ - It has both `KeyContainer` and `Compare` template parameters, and
55
+ ``` cpp
56
+ is_invocable_v<const Compare&,
57
+ const typename KeyContainer::value_type&,
58
+ const typename KeyContainer::value_type&>
59
+ ```
60
+
61
+ is not a valid expression or is `false`.
62
+ - It has both `MappedContainer` and `Allocator` template parameters, and
63
+ `uses_allocator_v<MappedContainer, Allocator>` is `false`.
64
+
65
+ The exposition-only alias template *`iter-value-type`* defined in
66
+ [[sequences.general]] and the exposition-only alias templates
67
+ *`iter-key-type`*, *`iter-mapped-type`*, *`range-key-type`*, and
68
+ *`range-mapped-type`* defined in [[associative.general]] may appear in
69
+ deduction guides for container adaptors.
70
+
71
+ The following exposition-only alias template may appear in deduction
72
+ guides for container adaptors:
73
+
74
+ ``` cpp
75
+ template<class Allocator, class T>
76
+ using alloc-rebind = // exposition only
77
+ typename allocator_traits<Allocator>::template rebind_alloc<T>;
78
+ ```
79