tmp/tmp9osbpymf/{from.md → to.md}
RENAMED
|
@@ -5,19 +5,19 @@
|
|
| 5 |
An `unordered_set` is an unordered associative container that supports
|
| 6 |
unique keys (an `unordered_set` contains at most one of each key value)
|
| 7 |
and in which the elements’ keys are the elements themselves. The
|
| 8 |
`unordered_set` class supports forward iterators.
|
| 9 |
|
| 10 |
-
An `unordered_set` meets all of the requirements of a container
|
| 11 |
-
|
| 12 |
-
[[container.alloc.
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
`
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
same type.
|
| 19 |
|
| 20 |
Subclause [[unord.set]] only describes operations on `unordered_set`
|
| 21 |
that are not described in one of the requirement tables, or for which
|
| 22 |
there is additional semantic information.
|
| 23 |
|
|
@@ -37,12 +37,12 @@ namespace std {
|
|
| 37 |
using allocator_type = Allocator;
|
| 38 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 39 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 40 |
using reference = value_type&;
|
| 41 |
using const_reference = const value_type&;
|
| 42 |
-
using size_type = implementation-defined; // see [container.requirements]
|
| 43 |
-
using difference_type = implementation-defined; // see [container.requirements]
|
| 44 |
|
| 45 |
using iterator = implementation-defined // type of unordered_set::iterator; // see [container.requirements]
|
| 46 |
using const_iterator = implementation-defined // type of unordered_set::const_iterator; // see [container.requirements]
|
| 47 |
using local_iterator = implementation-defined // type of unordered_set::local_iterator; // see [container.requirements]
|
| 48 |
using const_local_iterator = implementation-defined // type of unordered_set::const_local_iterator; // see [container.requirements]
|
|
@@ -59,15 +59,21 @@ namespace std {
|
|
| 59 |
unordered_set(InputIterator f, InputIterator l,
|
| 60 |
size_type n = see below,
|
| 61 |
const hasher& hf = hasher(),
|
| 62 |
const key_equal& eql = key_equal(),
|
| 63 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
unordered_set(const unordered_set&);
|
| 65 |
unordered_set(unordered_set&&);
|
| 66 |
explicit unordered_set(const Allocator&);
|
| 67 |
-
unordered_set(const unordered_set&, const Allocator&);
|
| 68 |
-
unordered_set(unordered_set&&, const Allocator&);
|
| 69 |
unordered_set(initializer_list<value_type> il,
|
| 70 |
size_type n = see below,
|
| 71 |
const hasher& hf = hasher(),
|
| 72 |
const key_equal& eql = key_equal(),
|
| 73 |
const allocator_type& a = allocator_type());
|
|
@@ -82,10 +88,16 @@ namespace std {
|
|
| 82 |
unordered_set(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 83 |
const allocator_type& a)
|
| 84 |
: unordered_set(f, l, n, hf, key_equal(), a) { }
|
| 85 |
unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 86 |
: unordered_set(il, n, hasher(), key_equal(), a) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
unordered_set(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 88 |
const allocator_type& a)
|
| 89 |
: unordered_set(il, n, hf, key_equal(), a) { }
|
| 90 |
~unordered_set();
|
| 91 |
unordered_set& operator=(const unordered_set&);
|
|
@@ -115,20 +127,25 @@ namespace std {
|
|
| 115 |
pair<iterator, bool> insert(const value_type& obj);
|
| 116 |
pair<iterator, bool> insert(value_type&& obj);
|
| 117 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 118 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 119 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
|
|
|
|
|
|
| 120 |
void insert(initializer_list<value_type>);
|
| 121 |
|
| 122 |
node_type extract(const_iterator position);
|
| 123 |
node_type extract(const key_type& x);
|
|
|
|
| 124 |
insert_return_type insert(node_type&& nh);
|
| 125 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 126 |
|
| 127 |
-
iterator erase(iterator position)
|
|
|
|
| 128 |
iterator erase(const_iterator position);
|
| 129 |
size_type erase(const key_type& k);
|
|
|
|
| 130 |
iterator erase(const_iterator first, const_iterator last);
|
| 131 |
void swap(unordered_set&)
|
| 132 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 133 |
is_nothrow_swappable_v<Hash> &&
|
| 134 |
is_nothrow_swappable_v<Pred>);
|
|
@@ -194,10 +211,18 @@ namespace std {
|
|
| 194 |
unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 195 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 196 |
-> unordered_set<iter-value-type<InputIterator>,
|
| 197 |
Hash, Pred, Allocator>;
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
template<class T, class Hash = hash<T>,
|
| 200 |
class Pred = equal_to<T>, class Allocator = allocator<T>>
|
| 201 |
unordered_set(initializer_list<T>, typename see below::size_type = see below,
|
| 202 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 203 |
-> unordered_set<T, Hash, Pred, Allocator>;
|
|
@@ -214,23 +239,32 @@ namespace std {
|
|
| 214 |
Hash, Allocator)
|
| 215 |
-> unordered_set<iter-value-type<InputIterator>, Hash,
|
| 216 |
equal_to<iter-value-type<InputIterator>>,
|
| 217 |
Allocator>;
|
| 218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
template<class T, class Allocator>
|
| 220 |
unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
|
| 221 |
-> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
|
| 222 |
|
| 223 |
template<class T, class Hash, class Allocator>
|
| 224 |
unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
|
| 225 |
-> unordered_set<T, Hash, equal_to<T>, Allocator>;
|
| 226 |
-
|
| 227 |
-
// swap
|
| 228 |
-
template<class Key, class Hash, class Pred, class Alloc>
|
| 229 |
-
void swap(unordered_set<Key, Hash, Pred, Alloc>& x,
|
| 230 |
-
unordered_set<Key, Hash, Pred, Alloc>& y)
|
| 231 |
-
noexcept(noexcept(x.swap(y)));
|
| 232 |
}
|
| 233 |
```
|
| 234 |
|
| 235 |
A `size_type` parameter type in an `unordered_set` deduction guide
|
| 236 |
refers to the `size_type` member type of the type deduced by the
|
|
@@ -258,10 +292,16 @@ template<class InputIterator>
|
|
| 258 |
unordered_set(InputIterator f, InputIterator l,
|
| 259 |
size_type n = see below,
|
| 260 |
const hasher& hf = hasher(),
|
| 261 |
const key_equal& eql = key_equal(),
|
| 262 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
unordered_set(initializer_list<value_type> il,
|
| 264 |
size_type n = see below,
|
| 265 |
const hasher& hf = hasher(),
|
| 266 |
const key_equal& eql = key_equal(),
|
| 267 |
const allocator_type& a = allocator_type());
|
|
@@ -269,12 +309,11 @@ unordered_set(initializer_list<value_type> il,
|
|
| 269 |
|
| 270 |
*Effects:* Constructs an empty `unordered_set` using the specified hash
|
| 271 |
function, key equality predicate, and allocator, and using at least `n`
|
| 272 |
buckets. If `n` is not provided, the number of buckets is
|
| 273 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 274 |
-
`l`)
|
| 275 |
-
for the second form. `max_load_factor()` returns `1.0`.
|
| 276 |
|
| 277 |
*Complexity:* Average case linear, worst case quadratic.
|
| 278 |
|
| 279 |
#### Erasure <a id="unord.set.erasure">[[unord.set.erasure]]</a>
|
| 280 |
|
|
|
|
| 5 |
An `unordered_set` is an unordered associative container that supports
|
| 6 |
unique keys (an `unordered_set` contains at most one of each key value)
|
| 7 |
and in which the elements’ keys are the elements themselves. The
|
| 8 |
`unordered_set` class supports forward iterators.
|
| 9 |
|
| 10 |
+
An `unordered_set` meets all of the requirements of a container
|
| 11 |
+
[[container.reqmts]], of an allocator-aware container
|
| 12 |
+
[[container.alloc.reqmts]], of an unordered associative container
|
| 13 |
+
[[unord.req]]. It provides the operations described in the preceding
|
| 14 |
+
requirements table for unique keys; that is, an `unordered_set` supports
|
| 15 |
+
the `a_uniq` operations in that table, not the `a_eq` operations. For an
|
| 16 |
+
`unordered_set<Key>` the `key_type` and the `value_type` are both `Key`.
|
| 17 |
+
The `iterator` and `const_iterator` types are both constant iterator
|
| 18 |
+
types. It is unspecified whether they are the same type.
|
| 19 |
|
| 20 |
Subclause [[unord.set]] only describes operations on `unordered_set`
|
| 21 |
that are not described in one of the requirement tables, or for which
|
| 22 |
there is additional semantic information.
|
| 23 |
|
|
|
|
| 37 |
using allocator_type = Allocator;
|
| 38 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 39 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 40 |
using reference = value_type&;
|
| 41 |
using const_reference = const value_type&;
|
| 42 |
+
using size_type = implementation-defined // type of unordered_set::size_type; // see [container.requirements]
|
| 43 |
+
using difference_type = implementation-defined // type of unordered_set::difference_type; // see [container.requirements]
|
| 44 |
|
| 45 |
using iterator = implementation-defined // type of unordered_set::iterator; // see [container.requirements]
|
| 46 |
using const_iterator = implementation-defined // type of unordered_set::const_iterator; // see [container.requirements]
|
| 47 |
using local_iterator = implementation-defined // type of unordered_set::local_iterator; // see [container.requirements]
|
| 48 |
using const_local_iterator = implementation-defined // type of unordered_set::const_local_iterator; // see [container.requirements]
|
|
|
|
| 59 |
unordered_set(InputIterator f, InputIterator l,
|
| 60 |
size_type n = see below,
|
| 61 |
const hasher& hf = hasher(),
|
| 62 |
const key_equal& eql = key_equal(),
|
| 63 |
const allocator_type& a = allocator_type());
|
| 64 |
+
template<container-compatible-range<value_type> R>
|
| 65 |
+
unordered_set(from_range_t, R&& rg,
|
| 66 |
+
size_type n = see below,
|
| 67 |
+
const hasher& hf = hasher(),
|
| 68 |
+
const key_equal& eql = key_equal(),
|
| 69 |
+
const allocator_type& a = allocator_type());
|
| 70 |
unordered_set(const unordered_set&);
|
| 71 |
unordered_set(unordered_set&&);
|
| 72 |
explicit unordered_set(const Allocator&);
|
| 73 |
+
unordered_set(const unordered_set&, const type_identity_t<Allocator>&);
|
| 74 |
+
unordered_set(unordered_set&&, const type_identity_t<Allocator>&);
|
| 75 |
unordered_set(initializer_list<value_type> il,
|
| 76 |
size_type n = see below,
|
| 77 |
const hasher& hf = hasher(),
|
| 78 |
const key_equal& eql = key_equal(),
|
| 79 |
const allocator_type& a = allocator_type());
|
|
|
|
| 88 |
unordered_set(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 89 |
const allocator_type& a)
|
| 90 |
: unordered_set(f, l, n, hf, key_equal(), a) { }
|
| 91 |
unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 92 |
: unordered_set(il, n, hasher(), key_equal(), a) { }
|
| 93 |
+
template<container-compatible-range<value_type> R>
|
| 94 |
+
unordered_set(from_range_t, R&& rg, size_type n, const allocator_type& a)
|
| 95 |
+
: unordered_set(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
|
| 96 |
+
template<container-compatible-range<value_type> R>
|
| 97 |
+
unordered_set(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
|
| 98 |
+
: unordered_set(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
|
| 99 |
unordered_set(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 100 |
const allocator_type& a)
|
| 101 |
: unordered_set(il, n, hf, key_equal(), a) { }
|
| 102 |
~unordered_set();
|
| 103 |
unordered_set& operator=(const unordered_set&);
|
|
|
|
| 127 |
pair<iterator, bool> insert(const value_type& obj);
|
| 128 |
pair<iterator, bool> insert(value_type&& obj);
|
| 129 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 130 |
iterator insert(const_iterator hint, value_type&& 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 |
+
iterator erase(iterator position)
|
| 143 |
+
requires (!same_as<iterator, const_iterator>);
|
| 144 |
iterator erase(const_iterator position);
|
| 145 |
size_type erase(const key_type& k);
|
| 146 |
+
template<class K> size_type erase(K&& x);
|
| 147 |
iterator erase(const_iterator first, const_iterator last);
|
| 148 |
void swap(unordered_set&)
|
| 149 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 150 |
is_nothrow_swappable_v<Hash> &&
|
| 151 |
is_nothrow_swappable_v<Pred>);
|
|
|
|
| 211 |
unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 212 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 213 |
-> unordered_set<iter-value-type<InputIterator>,
|
| 214 |
Hash, Pred, Allocator>;
|
| 215 |
|
| 216 |
+
template<ranges::input_range R,
|
| 217 |
+
class Hash = hash<ranges::range_value_t<R>>,
|
| 218 |
+
class Pred = equal_to<ranges::range_value_t<R>>,
|
| 219 |
+
class Allocator = allocator<ranges::range_value_t<R>>>
|
| 220 |
+
unordered_set(from_range_t, R&&, typename see below::size_type = see below,
|
| 221 |
+
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 222 |
+
-> unordered_set<ranges::range_value_t<R>, Hash, Pred, Allocator>;
|
| 223 |
+
|
| 224 |
template<class T, class Hash = hash<T>,
|
| 225 |
class Pred = equal_to<T>, class Allocator = allocator<T>>
|
| 226 |
unordered_set(initializer_list<T>, typename see below::size_type = see below,
|
| 227 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 228 |
-> unordered_set<T, Hash, Pred, Allocator>;
|
|
|
|
| 239 |
Hash, Allocator)
|
| 240 |
-> unordered_set<iter-value-type<InputIterator>, Hash,
|
| 241 |
equal_to<iter-value-type<InputIterator>>,
|
| 242 |
Allocator>;
|
| 243 |
|
| 244 |
+
template<ranges::input_range R, class Allocator>
|
| 245 |
+
unordered_set(from_range_t, R&&, typename see below::size_type, Allocator)
|
| 246 |
+
-> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
|
| 247 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 248 |
+
|
| 249 |
+
template<ranges::input_range R, class Allocator>
|
| 250 |
+
unordered_set(from_range_t, R&&, Allocator)
|
| 251 |
+
-> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
|
| 252 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 253 |
+
|
| 254 |
+
template<ranges::input_range R, class Hash, class Allocator>
|
| 255 |
+
unordered_set(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
|
| 256 |
+
-> unordered_set<ranges::range_value_t<R>, Hash,
|
| 257 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 258 |
+
|
| 259 |
template<class T, class Allocator>
|
| 260 |
unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
|
| 261 |
-> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
|
| 262 |
|
| 263 |
template<class T, class Hash, class Allocator>
|
| 264 |
unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
|
| 265 |
-> unordered_set<T, Hash, equal_to<T>, Allocator>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
}
|
| 267 |
```
|
| 268 |
|
| 269 |
A `size_type` parameter type in an `unordered_set` deduction guide
|
| 270 |
refers to the `size_type` member type of the type deduced by the
|
|
|
|
| 292 |
unordered_set(InputIterator f, InputIterator l,
|
| 293 |
size_type n = see below,
|
| 294 |
const hasher& hf = hasher(),
|
| 295 |
const key_equal& eql = key_equal(),
|
| 296 |
const allocator_type& a = allocator_type());
|
| 297 |
+
template<container-compatible-range<value_type> R>
|
| 298 |
+
unordered_multiset(from_range_t, R&& rg,
|
| 299 |
+
size_type n = see below,
|
| 300 |
+
const hasher& hf = hasher(),
|
| 301 |
+
const key_equal& eql = key_equal(),
|
| 302 |
+
const allocator_type& a = allocator_type());
|
| 303 |
unordered_set(initializer_list<value_type> il,
|
| 304 |
size_type n = see below,
|
| 305 |
const hasher& hf = hasher(),
|
| 306 |
const key_equal& eql = key_equal(),
|
| 307 |
const allocator_type& a = allocator_type());
|
|
|
|
| 309 |
|
| 310 |
*Effects:* Constructs an empty `unordered_set` using the specified hash
|
| 311 |
function, key equality predicate, and allocator, and using at least `n`
|
| 312 |
buckets. If `n` is not provided, the number of buckets is
|
| 313 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 314 |
+
`l`), `rg`, or `il`, respectively. `max_load_factor()` returns `1.0`.
|
|
|
|
| 315 |
|
| 316 |
*Complexity:* Average case linear, worst case quadratic.
|
| 317 |
|
| 318 |
#### Erasure <a id="unord.set.erasure">[[unord.set.erasure]]</a>
|
| 319 |
|