From Jason Turner

[unord.map.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpuah04z8w/{from.md → to.md} +123 -108
tmp/tmpuah04z8w/{from.md → to.md} RENAMED
@@ -16,10 +16,13 @@ the `a_uniq` operations in that table, not the `a_eq` operations. For an
16
 
17
  Subclause  [[unord.map]] only describes operations on `unordered_map`
18
  that are not described in one of the requirement tables, or for which
19
  there is additional semantic information.
20
 
 
 
 
21
  ``` cpp
22
  namespace std {
23
  template<class Key,
24
  class T,
25
  class Hash = hash<Key>,
@@ -32,12 +35,12 @@ namespace std {
32
  using mapped_type = T;
33
  using value_type = pair<const Key, T>;
34
  using hasher = Hash;
35
  using key_equal = Pred;
36
  using allocator_type = Allocator;
37
- using pointer = typename allocator_traits<Allocator>::pointer;
38
- using const_pointer = typename allocator_traits<Allocator>::const_pointer;
39
  using reference = value_type&;
40
  using const_reference = const value_type&;
41
  using size_type = implementation-defined // type of unordered_map::size_type; // see [container.requirements]
42
  using difference_type = implementation-defined // type of unordered_map::difference_type; // see [container.requirements]
43
 
@@ -47,185 +50,197 @@ namespace std {
47
  using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
48
  using node_type = unspecified;
49
  using insert_return_type = insert-return-type<iterator, node_type>;
50
 
51
  // [unord.map.cnstr], construct/copy/destroy
52
- unordered_map();
53
- explicit unordered_map(size_type n,
54
- const hasher& hf = hasher(),
55
  const key_equal& eql = key_equal(),
56
  const allocator_type& a = allocator_type());
57
  template<class InputIterator>
58
- unordered_map(InputIterator f, InputIterator l,
59
- size_type n = see below,
60
- const hasher& hf = hasher(),
61
  const key_equal& eql = key_equal(),
62
  const allocator_type& a = allocator_type());
63
 
64
  template<container-compatible-range<value_type> R>
65
- unordered_map(from_range_t, R&& rg, size_type n = see below,
66
  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
67
  const allocator_type& a = allocator_type());
68
- unordered_map(const unordered_map&);
69
- unordered_map(unordered_map&&);
70
- explicit unordered_map(const Allocator&);
71
- unordered_map(const unordered_map&, const type_identity_t<Allocator>&);
72
- unordered_map(unordered_map&&, const type_identity_t<Allocator>&);
73
- unordered_map(initializer_list<value_type> il,
74
- size_type n = see below,
75
  const hasher& hf = hasher(),
76
  const key_equal& eql = key_equal(),
77
  const allocator_type& a = allocator_type());
78
- unordered_map(size_type n, const allocator_type& a)
79
  : unordered_map(n, hasher(), key_equal(), a) { }
80
- unordered_map(size_type n, const hasher& hf, const allocator_type& a)
81
  : unordered_map(n, hf, key_equal(), a) { }
82
  template<class InputIterator>
83
- unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
 
84
  : unordered_map(f, l, n, hasher(), key_equal(), a) { }
85
  template<class InputIterator>
86
- unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
87
  const allocator_type& a)
88
  : unordered_map(f, l, n, hf, key_equal(), a) { }
89
  template<container-compatible-range<value_type> R>
90
- unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a)
91
  : unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
92
  template<container-compatible-range<value_type> R>
93
- unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
 
94
  : unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
95
- unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
 
96
  : unordered_map(il, n, hasher(), key_equal(), a) { }
97
- unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
98
  const allocator_type& a)
99
  : unordered_map(il, n, hf, key_equal(), a) { }
100
- ~unordered_map();
101
- unordered_map& operator=(const unordered_map&);
102
- unordered_map& operator=(unordered_map&&)
103
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
104
  is_nothrow_move_assignable_v<Hash> &&
105
  is_nothrow_move_assignable_v<Pred>);
106
- unordered_map& operator=(initializer_list<value_type>);
107
- allocator_type get_allocator() const noexcept;
108
 
109
  // iterators
110
- iterator begin() noexcept;
111
- const_iterator begin() const noexcept;
112
- iterator end() noexcept;
113
- const_iterator end() const noexcept;
114
- const_iterator cbegin() const noexcept;
115
- const_iterator cend() const noexcept;
116
 
117
  // capacity
118
- [[nodiscard]] bool empty() const noexcept;
119
- size_type size() const noexcept;
120
- size_type max_size() const noexcept;
121
 
122
  // [unord.map.modifiers], modifiers
123
- template<class... Args> pair<iterator, bool> emplace(Args&&... args);
124
- template<class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
125
- pair<iterator, bool> insert(const value_type& obj);
126
- pair<iterator, bool> insert(value_type&& obj);
127
- template<class P> pair<iterator, bool> insert(P&& obj);
128
- iterator insert(const_iterator hint, const value_type& obj);
129
- iterator insert(const_iterator hint, value_type&& obj);
130
- template<class P> iterator insert(const_iterator hint, P&& obj);
131
- template<class InputIterator> void insert(InputIterator first, InputIterator last);
 
132
  template<container-compatible-range<value_type> R>
133
- void insert_range(R&& rg);
134
- void insert(initializer_list<value_type>);
135
 
136
- node_type extract(const_iterator position);
137
- node_type extract(const key_type& x);
138
- template<class K> node_type extract(K&& x);
139
- insert_return_type insert(node_type&& nh);
140
- iterator insert(const_iterator hint, node_type&& nh);
141
 
142
  template<class... Args>
143
- pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
144
  template<class... Args>
145
- pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
 
 
146
  template<class... Args>
147
- iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
148
  template<class... Args>
149
- iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
 
 
150
  template<class M>
151
- pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
152
  template<class M>
153
- pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
 
 
154
  template<class M>
155
- iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
156
  template<class M>
157
- iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
 
 
158
 
159
- iterator erase(iterator position);
160
- iterator erase(const_iterator position);
161
- size_type erase(const key_type& k);
162
- template<class K> size_type erase(K&& x);
163
- iterator erase(const_iterator first, const_iterator last);
164
- void swap(unordered_map&)
165
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
166
- is_nothrow_swappable_v<Hash> &&
167
- is_nothrow_swappable_v<Pred>);
168
- void clear() noexcept;
169
 
170
  template<class H2, class P2>
171
- void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
172
  template<class H2, class P2>
173
- void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
174
  template<class H2, class P2>
175
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source);
176
  template<class H2, class P2>
177
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source);
178
 
179
  // observers
180
- hasher hash_function() const;
181
- key_equal key_eq() const;
182
 
183
  // map operations
184
- iterator find(const key_type& k);
185
- const_iterator find(const key_type& k) const;
186
  template<class K>
187
- iterator find(const K& k);
188
  template<class K>
189
- const_iterator find(const K& k) const;
190
- size_type count(const key_type& k) const;
191
  template<class K>
192
- size_type count(const K& k) const;
193
- bool contains(const key_type& k) const;
194
  template<class K>
195
- bool contains(const K& k) const;
196
- pair<iterator, iterator> equal_range(const key_type& k);
197
- pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
198
  template<class K>
199
- pair<iterator, iterator> equal_range(const K& k);
200
  template<class K>
201
- pair<const_iterator, const_iterator> equal_range(const K& k) const;
202
 
203
  // [unord.map.elem], element access
204
- mapped_type& operator[](const key_type& k);
205
- mapped_type& operator[](key_type&& k);
206
- mapped_type& at(const key_type& k);
207
- const mapped_type& at(const key_type& k) const;
 
 
 
208
 
209
  // bucket interface
210
- size_type bucket_count() const noexcept;
211
- size_type max_bucket_count() const noexcept;
212
- size_type bucket_size(size_type n) const;
213
- size_type bucket(const key_type& k) const;
214
- local_iterator begin(size_type n);
215
- const_local_iterator begin(size_type n) const;
216
- local_iterator end(size_type n);
217
- const_local_iterator end(size_type n) const;
218
- const_local_iterator cbegin(size_type n) const;
219
- const_local_iterator cend(size_type n) const;
 
220
 
221
  // hash policy
222
- float load_factor() const noexcept;
223
- float max_load_factor() const noexcept;
224
- void max_load_factor(float z);
225
- void rehash(size_type n);
226
- void reserve(size_type n);
227
  };
228
 
229
  template<class InputIterator,
230
  class Hash = hash<iter-key-type<InputIterator>>,
231
  class Pred = equal_to<iter-key-type<InputIterator>>,
 
16
 
17
  Subclause  [[unord.map]] only describes operations on `unordered_map`
18
  that are not described in one of the requirement tables, or for which
19
  there is additional semantic information.
20
 
21
+ The types `iterator` and `const_iterator` meet the constexpr iterator
22
+ requirements [[iterator.requirements.general]].
23
+
24
  ``` cpp
25
  namespace std {
26
  template<class Key,
27
  class T,
28
  class Hash = hash<Key>,
 
35
  using mapped_type = T;
36
  using value_type = pair<const Key, T>;
37
  using hasher = Hash;
38
  using key_equal = Pred;
39
  using allocator_type = Allocator;
40
+ using pointer = allocator_traits<Allocator>::pointer;
41
+ using const_pointer = allocator_traits<Allocator>::const_pointer;
42
  using reference = value_type&;
43
  using const_reference = const value_type&;
44
  using size_type = implementation-defined // type of unordered_map::size_type; // see [container.requirements]
45
  using difference_type = implementation-defined // type of unordered_map::difference_type; // see [container.requirements]
46
 
 
50
  using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
51
  using node_type = unspecified;
52
  using insert_return_type = insert-return-type<iterator, node_type>;
53
 
54
  // [unord.map.cnstr], construct/copy/destroy
55
+ constexpr unordered_map();
56
+ constexpr explicit unordered_map(size_type n, const hasher& hf = hasher(),
 
57
  const key_equal& eql = key_equal(),
58
  const allocator_type& a = allocator_type());
59
  template<class InputIterator>
60
+ constexpr unordered_map(InputIterator f, InputIterator l,
61
+ size_type n = see below, const hasher& hf = hasher(),
 
62
  const key_equal& eql = key_equal(),
63
  const allocator_type& a = allocator_type());
64
 
65
  template<container-compatible-range<value_type> R>
66
+ constexpr unordered_map(from_range_t, R&& rg, size_type n = see below,
67
  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
68
  const allocator_type& a = allocator_type());
69
+ constexpr unordered_map(const unordered_map&);
70
+ constexpr unordered_map(unordered_map&&);
71
+ constexpr explicit unordered_map(const Allocator&);
72
+ constexpr unordered_map(const unordered_map&, const type_identity_t<Allocator>&);
73
+ constexpr unordered_map(unordered_map&&, const type_identity_t<Allocator>&);
74
+ constexpr unordered_map(initializer_list<value_type> il, size_type n = see below,
 
75
  const hasher& hf = hasher(),
76
  const key_equal& eql = key_equal(),
77
  const allocator_type& a = allocator_type());
78
+ constexpr unordered_map(size_type n, const allocator_type& a)
79
  : unordered_map(n, hasher(), key_equal(), a) { }
80
+ constexpr unordered_map(size_type n, const hasher& hf, const allocator_type& a)
81
  : unordered_map(n, hf, key_equal(), a) { }
82
  template<class InputIterator>
83
+ constexpr unordered_map(InputIterator f, InputIterator l, size_type n,
84
+ const allocator_type& a)
85
  : unordered_map(f, l, n, hasher(), key_equal(), a) { }
86
  template<class InputIterator>
87
+ constexpr unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
88
  const allocator_type& a)
89
  : unordered_map(f, l, n, hf, key_equal(), a) { }
90
  template<container-compatible-range<value_type> R>
91
+ constexpr unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a)
92
  : unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
93
  template<container-compatible-range<value_type> R>
94
+ constexpr unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf,
95
+ const allocator_type& a)
96
  : unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
97
+ constexpr unordered_map(initializer_list<value_type> il, size_type n,
98
+ const allocator_type& a)
99
  : unordered_map(il, n, hasher(), key_equal(), a) { }
100
+ constexpr unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
101
  const allocator_type& a)
102
  : unordered_map(il, n, hf, key_equal(), a) { }
103
+ constexpr ~unordered_map();
104
+ constexpr unordered_map& operator=(const unordered_map&);
105
+ constexpr unordered_map& operator=(unordered_map&&)
106
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
107
  is_nothrow_move_assignable_v<Hash> &&
108
  is_nothrow_move_assignable_v<Pred>);
109
+ constexpr unordered_map& operator=(initializer_list<value_type>);
110
+ constexpr allocator_type get_allocator() const noexcept;
111
 
112
  // iterators
113
+ constexpr iterator begin() noexcept;
114
+ constexpr const_iterator begin() const noexcept;
115
+ constexpr iterator end() noexcept;
116
+ constexpr const_iterator end() const noexcept;
117
+ constexpr const_iterator cbegin() const noexcept;
118
+ constexpr const_iterator cend() const noexcept;
119
 
120
  // capacity
121
+ constexpr bool empty() const noexcept;
122
+ constexpr size_type size() const noexcept;
123
+ constexpr size_type max_size() const noexcept;
124
 
125
  // [unord.map.modifiers], modifiers
126
+ template<class... Args> constexpr pair<iterator, bool> emplace(Args&&... args);
127
+ template<class... Args>
128
+ constexpr iterator emplace_hint(const_iterator position, Args&&... args);
129
+ constexpr pair<iterator, bool> insert(const value_type& obj);
130
+ constexpr pair<iterator, bool> insert(value_type&& obj);
131
+ template<class P> constexpr pair<iterator, bool> insert(P&& obj);
132
+ constexpr iterator insert(const_iterator hint, const value_type& obj);
133
+ constexpr iterator insert(const_iterator hint, value_type&& obj);
134
+ template<class P> constexpr iterator insert(const_iterator hint, P&& obj);
135
+ template<class InputIterator> constexpr void insert(InputIterator first, InputIterator last);
136
  template<container-compatible-range<value_type> R>
137
+ constexpr void insert_range(R&& rg);
138
+ constexpr void insert(initializer_list<value_type>);
139
 
140
+ constexpr node_type extract(const_iterator position);
141
+ constexpr node_type extract(const key_type& x);
142
+ template<class K> constexpr node_type extract(K&& x);
143
+ constexpr insert_return_type insert(node_type&& nh);
144
+ constexpr iterator insert(const_iterator hint, node_type&& nh);
145
 
146
  template<class... Args>
147
+ constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
148
  template<class... Args>
149
+ constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
150
+ template<class K, class... Args>
151
+ constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args);
152
  template<class... Args>
153
+ constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
154
  template<class... Args>
155
+ constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
156
+ template<class K, class... Args>
157
+ constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
158
  template<class M>
159
+ constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
160
  template<class M>
161
+ constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
162
+ template<class K, class M>
163
+ constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
164
  template<class M>
165
+ constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
166
  template<class M>
167
+ constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
168
+ template<class K, class M>
169
+ constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
170
 
171
+ constexpr iterator erase(iterator position);
172
+ constexpr iterator erase(const_iterator position);
173
+ constexpr size_type erase(const key_type& k);
174
+ template<class K> constexpr size_type erase(K&& x);
175
+ constexpr iterator erase(const_iterator first, const_iterator last);
176
+ constexpr void swap(unordered_map&)
177
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
178
+ is_nothrow_swappable_v<Hash> && is_nothrow_swappable_v<Pred>);
179
+ constexpr void clear() noexcept;
 
180
 
181
  template<class H2, class P2>
182
+ constexpr void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
183
  template<class H2, class P2>
184
+ constexpr void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
185
  template<class H2, class P2>
186
+ constexpr void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source);
187
  template<class H2, class P2>
188
+ constexpr void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source);
189
 
190
  // observers
191
+ constexpr hasher hash_function() const;
192
+ constexpr key_equal key_eq() const;
193
 
194
  // map operations
195
+ constexpr iterator find(const key_type& k);
196
+ constexpr const_iterator find(const key_type& k) const;
197
  template<class K>
198
+ constexpr iterator find(const K& k);
199
  template<class K>
200
+ constexpr const_iterator find(const K& k) const;
201
+ constexpr size_type count(const key_type& k) const;
202
  template<class K>
203
+ constexpr size_type count(const K& k) const;
204
+ constexpr bool contains(const key_type& k) const;
205
  template<class K>
206
+ constexpr bool contains(const K& k) const;
207
+ constexpr pair<iterator, iterator> equal_range(const key_type& k);
208
+ constexpr pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
209
  template<class K>
210
+ constexpr pair<iterator, iterator> equal_range(const K& k);
211
  template<class K>
212
+ constexpr pair<const_iterator, const_iterator> equal_range(const K& k) const;
213
 
214
  // [unord.map.elem], element access
215
+ constexpr mapped_type& operator[](const key_type& k);
216
+ constexpr mapped_type& operator[](key_type&& k);
217
+ template<class K> constexpr mapped_type& operator[](K&& k);
218
+ constexpr mapped_type& at(const key_type& k);
219
+ constexpr const mapped_type& at(const key_type& k) const;
220
+ template<class K> constexpr mapped_type& at(const K& k);
221
+ template<class K> constexpr const mapped_type& at(const K& k) const;
222
 
223
  // bucket interface
224
+ constexpr size_type bucket_count() const noexcept;
225
+ constexpr size_type max_bucket_count() const noexcept;
226
+ constexpr size_type bucket_size(size_type n) const;
227
+ constexpr size_type bucket(const key_type& k) const;
228
+ template<class K> constexpr size_type bucket(const K& k) const;
229
+ constexpr local_iterator begin(size_type n);
230
+ constexpr const_local_iterator begin(size_type n) const;
231
+ constexpr local_iterator end(size_type n);
232
+ constexpr const_local_iterator end(size_type n) const;
233
+ constexpr const_local_iterator cbegin(size_type n) const;
234
+ constexpr const_local_iterator cend(size_type n) const;
235
 
236
  // hash policy
237
+ constexpr float load_factor() const noexcept;
238
+ constexpr float max_load_factor() const noexcept;
239
+ constexpr void max_load_factor(float z);
240
+ constexpr void rehash(size_type n);
241
+ constexpr void reserve(size_type n);
242
  };
243
 
244
  template<class InputIterator,
245
  class Hash = hash<iter-key-type<InputIterator>>,
246
  class Pred = equal_to<iter-key-type<InputIterator>>,