From Jason Turner

[unord.set.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwex6hf6n/{from.md → to.md} +54 -20
tmp/tmpwex6hf6n/{from.md → to.md} RENAMED
@@ -3,19 +3,19 @@
3
  An `unordered_set` is an unordered associative container that supports
4
  unique keys (an `unordered_set` contains at most one of each key value)
5
  and in which the elements’ keys are the elements themselves. The
6
  `unordered_set` class supports forward iterators.
7
 
8
- An `unordered_set` meets all of the requirements of a container, of an
9
- unordered associative container, and of an allocator-aware container (
10
- [[container.alloc.req]]). It provides the operations described in the
11
- preceding requirements table for unique keys; that is, an
12
- `unordered_set` supports the `a_uniq` operations in that table, not the
13
- `a_eq` operations. For an `unordered_set<Key>` the `key type` and the
14
- value type are both `Key`. The `iterator` and `const_iterator` types are
15
- both constant iterator types. It is unspecified whether they are the
16
- same type.
17
 
18
  Subclause  [[unord.set]] only describes operations on `unordered_set`
19
  that are not described in one of the requirement tables, or for which
20
  there is additional semantic information.
21
 
@@ -35,12 +35,12 @@ namespace std {
35
  using allocator_type = Allocator;
36
  using pointer = typename allocator_traits<Allocator>::pointer;
37
  using const_pointer = typename allocator_traits<Allocator>::const_pointer;
38
  using reference = value_type&;
39
  using const_reference = const value_type&;
40
- using size_type = implementation-defined; // see [container.requirements]
41
- using difference_type = implementation-defined; // see [container.requirements]
42
 
43
  using iterator = implementation-defined // type of unordered_set::iterator; // see [container.requirements]
44
  using const_iterator = implementation-defined // type of unordered_set::const_iterator; // see [container.requirements]
45
  using local_iterator = implementation-defined // type of unordered_set::local_iterator; // see [container.requirements]
46
  using const_local_iterator = implementation-defined // type of unordered_set::const_local_iterator; // see [container.requirements]
@@ -57,15 +57,21 @@ namespace std {
57
  unordered_set(InputIterator f, InputIterator l,
58
  size_type n = see below,
59
  const hasher& hf = hasher(),
60
  const key_equal& eql = key_equal(),
61
  const allocator_type& a = allocator_type());
 
 
 
 
 
 
62
  unordered_set(const unordered_set&);
63
  unordered_set(unordered_set&&);
64
  explicit unordered_set(const Allocator&);
65
- unordered_set(const unordered_set&, const Allocator&);
66
- unordered_set(unordered_set&&, const Allocator&);
67
  unordered_set(initializer_list<value_type> il,
68
  size_type n = see below,
69
  const hasher& hf = hasher(),
70
  const key_equal& eql = key_equal(),
71
  const allocator_type& a = allocator_type());
@@ -80,10 +86,16 @@ namespace std {
80
  unordered_set(InputIterator f, InputIterator l, size_type n, const hasher& hf,
81
  const allocator_type& a)
82
  : unordered_set(f, l, n, hf, key_equal(), a) { }
83
  unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a)
84
  : unordered_set(il, n, hasher(), key_equal(), a) { }
 
 
 
 
 
 
85
  unordered_set(initializer_list<value_type> il, size_type n, const hasher& hf,
86
  const allocator_type& a)
87
  : unordered_set(il, n, hf, key_equal(), a) { }
88
  ~unordered_set();
89
  unordered_set& operator=(const unordered_set&);
@@ -113,20 +125,25 @@ namespace std {
113
  pair<iterator, bool> insert(const value_type& obj);
114
  pair<iterator, bool> insert(value_type&& obj);
115
  iterator insert(const_iterator hint, const value_type& obj);
116
  iterator insert(const_iterator hint, value_type&& obj);
117
  template<class InputIterator> void insert(InputIterator first, InputIterator last);
 
 
118
  void insert(initializer_list<value_type>);
119
 
120
  node_type extract(const_iterator position);
121
  node_type extract(const key_type& x);
 
122
  insert_return_type insert(node_type&& nh);
123
  iterator insert(const_iterator hint, node_type&& nh);
124
 
125
- iterator erase(iterator position);
 
126
  iterator erase(const_iterator position);
127
  size_type erase(const key_type& k);
 
128
  iterator erase(const_iterator first, const_iterator last);
129
  void swap(unordered_set&)
130
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
131
  is_nothrow_swappable_v<Hash> &&
132
  is_nothrow_swappable_v<Pred>);
@@ -192,10 +209,18 @@ namespace std {
192
  unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
193
  Hash = Hash(), Pred = Pred(), Allocator = Allocator())
194
  -> unordered_set<iter-value-type<InputIterator>,
195
  Hash, Pred, Allocator>;
196
 
 
 
 
 
 
 
 
 
197
  template<class T, class Hash = hash<T>,
198
  class Pred = equal_to<T>, class Allocator = allocator<T>>
199
  unordered_set(initializer_list<T>, typename see below::size_type = see below,
200
  Hash = Hash(), Pred = Pred(), Allocator = Allocator())
201
  -> unordered_set<T, Hash, Pred, Allocator>;
@@ -212,23 +237,32 @@ namespace std {
212
  Hash, Allocator)
213
  -> unordered_set<iter-value-type<InputIterator>, Hash,
214
  equal_to<iter-value-type<InputIterator>>,
215
  Allocator>;
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  template<class T, class Allocator>
218
  unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
219
  -> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
220
 
221
  template<class T, class Hash, class Allocator>
222
  unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
223
  -> unordered_set<T, Hash, equal_to<T>, Allocator>;
224
-
225
- // swap
226
- template<class Key, class Hash, class Pred, class Alloc>
227
- void swap(unordered_set<Key, Hash, Pred, Alloc>& x,
228
- unordered_set<Key, Hash, Pred, Alloc>& y)
229
- noexcept(noexcept(x.swap(y)));
230
  }
231
  ```
232
 
233
  A `size_type` parameter type in an `unordered_set` deduction guide
234
  refers to the `size_type` member type of the type deduced by the
 
3
  An `unordered_set` is an unordered associative container that supports
4
  unique keys (an `unordered_set` contains at most one of each key value)
5
  and in which the elements’ keys are the elements themselves. The
6
  `unordered_set` class supports forward iterators.
7
 
8
+ An `unordered_set` meets all of the requirements of a container
9
+ [[container.reqmts]], of an allocator-aware container
10
+ [[container.alloc.reqmts]], of an unordered associative container
11
+ [[unord.req]]. It provides the operations described in the preceding
12
+ requirements table for unique keys; that is, an `unordered_set` supports
13
+ the `a_uniq` operations in that table, not the `a_eq` operations. For an
14
+ `unordered_set<Key>` the `key_type` and the `value_type` are both `Key`.
15
+ The `iterator` and `const_iterator` types are both constant iterator
16
+ types. It is unspecified whether they are the same type.
17
 
18
  Subclause  [[unord.set]] only describes operations on `unordered_set`
19
  that are not described in one of the requirement tables, or for which
20
  there is additional semantic information.
21
 
 
35
  using allocator_type = Allocator;
36
  using pointer = typename allocator_traits<Allocator>::pointer;
37
  using const_pointer = typename allocator_traits<Allocator>::const_pointer;
38
  using reference = value_type&;
39
  using const_reference = const value_type&;
40
+ using size_type = implementation-defined // type of unordered_set::size_type; // see [container.requirements]
41
+ using difference_type = implementation-defined // type of unordered_set::difference_type; // see [container.requirements]
42
 
43
  using iterator = implementation-defined // type of unordered_set::iterator; // see [container.requirements]
44
  using const_iterator = implementation-defined // type of unordered_set::const_iterator; // see [container.requirements]
45
  using local_iterator = implementation-defined // type of unordered_set::local_iterator; // see [container.requirements]
46
  using const_local_iterator = implementation-defined // type of unordered_set::const_local_iterator; // see [container.requirements]
 
57
  unordered_set(InputIterator f, InputIterator l,
58
  size_type n = see below,
59
  const hasher& hf = hasher(),
60
  const key_equal& eql = key_equal(),
61
  const allocator_type& a = allocator_type());
62
+ template<container-compatible-range<value_type> R>
63
+ unordered_set(from_range_t, R&& rg,
64
+ size_type n = see below,
65
+ const hasher& hf = hasher(),
66
+ const key_equal& eql = key_equal(),
67
+ const allocator_type& a = allocator_type());
68
  unordered_set(const unordered_set&);
69
  unordered_set(unordered_set&&);
70
  explicit unordered_set(const Allocator&);
71
+ unordered_set(const unordered_set&, const type_identity_t<Allocator>&);
72
+ unordered_set(unordered_set&&, const type_identity_t<Allocator>&);
73
  unordered_set(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());
 
86
  unordered_set(InputIterator f, InputIterator l, size_type n, const hasher& hf,
87
  const allocator_type& a)
88
  : unordered_set(f, l, n, hf, key_equal(), a) { }
89
  unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a)
90
  : unordered_set(il, n, hasher(), key_equal(), a) { }
91
+ template<container-compatible-range<value_type> R>
92
+ unordered_set(from_range_t, R&& rg, size_type n, const allocator_type& a)
93
+ : unordered_set(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
94
+ template<container-compatible-range<value_type> R>
95
+ unordered_set(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
96
+ : unordered_set(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
97
  unordered_set(initializer_list<value_type> il, size_type n, const hasher& hf,
98
  const allocator_type& a)
99
  : unordered_set(il, n, hf, key_equal(), a) { }
100
  ~unordered_set();
101
  unordered_set& operator=(const unordered_set&);
 
125
  pair<iterator, bool> insert(const value_type& obj);
126
  pair<iterator, bool> insert(value_type&& obj);
127
  iterator insert(const_iterator hint, const value_type& obj);
128
  iterator insert(const_iterator hint, value_type&& obj);
129
  template<class InputIterator> void insert(InputIterator first, InputIterator last);
130
+ template<container-compatible-range<value_type> R>
131
+ void insert_range(R&& rg);
132
  void insert(initializer_list<value_type>);
133
 
134
  node_type extract(const_iterator position);
135
  node_type extract(const key_type& x);
136
+ template<class K> node_type extract(K&& x);
137
  insert_return_type insert(node_type&& nh);
138
  iterator insert(const_iterator hint, node_type&& nh);
139
 
140
+ iterator erase(iterator position)
141
+ requires (!same_as<iterator, const_iterator>);
142
  iterator erase(const_iterator position);
143
  size_type erase(const key_type& k);
144
+ template<class K> size_type erase(K&& x);
145
  iterator erase(const_iterator first, const_iterator last);
146
  void swap(unordered_set&)
147
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
148
  is_nothrow_swappable_v<Hash> &&
149
  is_nothrow_swappable_v<Pred>);
 
209
  unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
210
  Hash = Hash(), Pred = Pred(), Allocator = Allocator())
211
  -> unordered_set<iter-value-type<InputIterator>,
212
  Hash, Pred, Allocator>;
213
 
214
+ template<ranges::input_range R,
215
+ class Hash = hash<ranges::range_value_t<R>>,
216
+ class Pred = equal_to<ranges::range_value_t<R>>,
217
+ class Allocator = allocator<ranges::range_value_t<R>>>
218
+ unordered_set(from_range_t, R&&, typename see below::size_type = see below,
219
+ Hash = Hash(), Pred = Pred(), Allocator = Allocator())
220
+ -> unordered_set<ranges::range_value_t<R>, Hash, Pred, Allocator>;
221
+
222
  template<class T, class Hash = hash<T>,
223
  class Pred = equal_to<T>, class Allocator = allocator<T>>
224
  unordered_set(initializer_list<T>, typename see below::size_type = see below,
225
  Hash = Hash(), Pred = Pred(), Allocator = Allocator())
226
  -> unordered_set<T, Hash, Pred, Allocator>;
 
237
  Hash, Allocator)
238
  -> unordered_set<iter-value-type<InputIterator>, Hash,
239
  equal_to<iter-value-type<InputIterator>>,
240
  Allocator>;
241
 
242
+ template<ranges::input_range R, class Allocator>
243
+ unordered_set(from_range_t, R&&, typename see below::size_type, Allocator)
244
+ -> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
245
+ equal_to<ranges::range_value_t<R>>, Allocator>;
246
+
247
+ template<ranges::input_range R, class Allocator>
248
+ unordered_set(from_range_t, R&&, Allocator)
249
+ -> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
250
+ equal_to<ranges::range_value_t<R>>, Allocator>;
251
+
252
+ template<ranges::input_range R, class Hash, class Allocator>
253
+ unordered_set(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
254
+ -> unordered_set<ranges::range_value_t<R>, Hash,
255
+ equal_to<ranges::range_value_t<R>>, Allocator>;
256
+
257
  template<class T, class Allocator>
258
  unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
259
  -> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
260
 
261
  template<class T, class Hash, class Allocator>
262
  unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
263
  -> unordered_set<T, Hash, equal_to<T>, Allocator>;
 
 
 
 
 
 
264
  }
265
  ```
266
 
267
  A `size_type` parameter type in an `unordered_set` deduction guide
268
  refers to the `size_type` member type of the type deduced by the