From Jason Turner

[unord.map.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4b3z2hy1/{from.md → to.md} +67 -10
tmp/tmp4b3z2hy1/{from.md → to.md} RENAMED
@@ -1,31 +1,31 @@
1
  #### Modifiers <a id="unord.map.modifiers">[[unord.map.modifiers]]</a>
2
 
3
  ``` cpp
4
  template<class P>
5
- pair<iterator, bool> insert(P&& obj);
6
  ```
7
 
8
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
9
 
10
  *Effects:* Equivalent to: `return emplace(std::forward<P>(obj));`
11
 
12
  ``` cpp
13
  template<class P>
14
- iterator insert(const_iterator hint, P&& obj);
15
  ```
16
 
17
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
18
 
19
  *Effects:* Equivalent to:
20
  `return emplace_hint(hint, std::forward<P>(obj));`
21
 
22
  ``` cpp
23
  template<class... Args>
24
- pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
25
  template<class... Args>
26
- iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
27
  ```
28
 
29
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
30
  `unordered_map` from `piecewise_construct`, `forward_as_tuple(k)`,
31
  `forward_as_tuple(std::forward<Args>(args)...)`.
@@ -41,13 +41,13 @@ iterator points to the map element whose key is equivalent to `k`.
41
 
42
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
43
 
44
  ``` cpp
45
  template<class... Args>
46
- pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
47
  template<class... Args>
48
- iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
49
  ```
50
 
51
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
52
  `unordered_map` from `piecewise_construct`,
53
  `forward_as_tuple(std::move(k))`,
@@ -63,15 +63,44 @@ type `value_type` constructed with `piecewise_construct`,
63
  pair is `true` if and only if the insertion took place. The returned
64
  iterator points to the map element whose key is equivalent to `k`.
65
 
66
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  ``` cpp
69
  template<class M>
70
- pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
71
  template<class M>
72
- iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
73
  ```
74
 
75
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
76
 
77
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
@@ -88,13 +117,13 @@ iterator points to the map element whose key is equivalent to `k`.
88
 
89
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
90
 
91
  ``` cpp
92
  template<class M>
93
- pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
94
  template<class M>
95
- iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
96
  ```
97
 
98
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
99
 
100
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
@@ -109,5 +138,33 @@ Otherwise inserts an object of type `value_type` constructed with
109
  pair is `true` if and only if the insertion took place. The returned
110
  iterator points to the map element whose key is equivalent to `k`.
111
 
112
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #### Modifiers <a id="unord.map.modifiers">[[unord.map.modifiers]]</a>
2
 
3
  ``` cpp
4
  template<class P>
5
+ constexpr pair<iterator, bool> insert(P&& obj);
6
  ```
7
 
8
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
9
 
10
  *Effects:* Equivalent to: `return emplace(std::forward<P>(obj));`
11
 
12
  ``` cpp
13
  template<class P>
14
+ constexpr iterator insert(const_iterator hint, P&& obj);
15
  ```
16
 
17
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
18
 
19
  *Effects:* Equivalent to:
20
  `return emplace_hint(hint, std::forward<P>(obj));`
21
 
22
  ``` cpp
23
  template<class... Args>
24
+ constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
25
  template<class... Args>
26
+ constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
27
  ```
28
 
29
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
30
  `unordered_map` from `piecewise_construct`, `forward_as_tuple(k)`,
31
  `forward_as_tuple(std::forward<Args>(args)...)`.
 
41
 
42
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
43
 
44
  ``` cpp
45
  template<class... Args>
46
+ constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
47
  template<class... Args>
48
+ constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
49
  ```
50
 
51
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
52
  `unordered_map` from `piecewise_construct`,
53
  `forward_as_tuple(std::move(k))`,
 
63
  pair is `true` if and only if the insertion took place. The returned
64
  iterator points to the map element whose key is equivalent to `k`.
65
 
66
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
67
 
68
+ ``` cpp
69
+ template<class K, class... Args>
70
+ constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args);
71
+ template<class K, class... Args>
72
+ constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
73
+ ```
74
+
75
+ *Constraints:* The *qualified-id*s `Hash::is_transparent` and
76
+ `Pred::is_transparent` are valid and denote types. For the first
77
+ overload, `is_convertible_v<K&&, const_iterator>` and
78
+ `is_convertible_v<K&&, iterator>` are both `false`.
79
+
80
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
81
+ `unordered_map` from
82
+ `piecewise_construct, forward_as_tuple(std::forward<K>(k)), forward_as_tuple(std::forward<Args> (args)...)`.
83
+
84
+ *Effects:* If the map already contains an element whose key is
85
+ equivalent to `k`, there is no effect. Otherwise, let `h` be
86
+ `hash_function()(k)`. Constructs an object `u` of type `value_type` with
87
+ `piecewise_construct, forward_as_tuple(std::forward<K>(k)), forward_as_tuple(std::forward<Args>(args)...)`.
88
+ If `hash_function()(u.first) != h || contains(u.first)` is `true`, the
89
+ behavior is undefined. Inserts `u` into `*this`.
90
+
91
+ *Returns:* For the first overload, the `bool` component of the returned
92
+ pair is `true` if and only if the insertion took place. The returned
93
+ iterator points to the map element whose key is equivalent to `k`.
94
+
95
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
96
+
97
  ``` cpp
98
  template<class M>
99
+ constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
100
  template<class M>
101
+ constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
102
  ```
103
 
104
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
105
 
106
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
 
117
 
118
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
119
 
120
  ``` cpp
121
  template<class M>
122
+ constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
123
  template<class M>
124
+ constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
125
  ```
126
 
127
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
128
 
129
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
 
138
  pair is `true` if and only if the insertion took place. The returned
139
  iterator points to the map element whose key is equivalent to `k`.
140
 
141
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
142
 
143
+ ``` cpp
144
+ template<class K, class M>
145
+ constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
146
+ template<class K, class M>
147
+ constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
148
+ ```
149
+
150
+ *Constraints:* The *qualified-id*s `Hash::is_transparent` and
151
+ `Pred::is_transparent` are valid and denote types.
152
+
153
+ *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
154
+
155
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
156
+ `unordered_map` from `std::forward<K> (k), std::forward<M>(obj)`.
157
+
158
+ *Effects:* If the map already contains an element `e` whose key is
159
+ equivalent to `k`, assigns `std::forward<M> (obj)` to `e.second`.
160
+ Otherwise, let `h` be `hash_function()(k)`. Constructs an object `u` of
161
+ type `value_type` with `std::forward<K>(k), std::forward<M>(obj)`. If
162
+ `hash_function()(u.first) != h || contains(u.first)` is `true`, the
163
+ behavior is undefined. Inserts `u` into `*this`.
164
+
165
+ *Returns:* For the first overload, the `bool` component of the returned
166
+ pair is `true` if and only if the insertion took place. The returned
167
+ iterator points to the map element whose key is equivalent to `k`.
168
+
169
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
170
+