std::unordered_set<Key,Hash,KeyEqual,Allocator>:: unordered_set
| (1) | ||
|
unordered_set
(
)
: unordered_set ( size_type ( /* 未指定 */ ) ) { } |
(自 C++11 起)
(直至 C++20) |
|
|
unordered_set
(
)
;
|
(自 C++20 起) | |
|
explicit
unordered_set
(
size_type bucket_count,
const
Hash
&
hash
=
Hash
(
)
,
|
(2) | (自 C++11 起) |
|
unordered_set
(
size_type bucket_count,
const
Allocator
&
alloc
)
|
(3) | (自 C++14 起) |
|
unordered_set
(
size_type bucket_count,
const
Hash
&
hash,
|
(4) | (自 C++14 起) |
|
explicit
unordered_set
(
const
Allocator
&
alloc
)
;
|
(5) | (自 C++11 起) |
|
template
<
class
InputIt
>
unordered_set
(
InputIt first, InputIt last,
|
(6) | (自 C++11 起) |
|
template
<
class
InputIt
>
unordered_set
(
InputIt first, InputIt last,
|
(7) | (自 C++14 起) |
|
template
<
class
InputIt
>
unordered_set
(
InputIt first, InputIt last,
|
(8) | (自 C++14 起) |
|
unordered_set
(
const
unordered_set
&
other
)
;
|
(9) | (自 C++11 起) |
|
unordered_set
(
const
unordered_set
&
other,
const
Allocator
&
alloc
)
;
|
(10) | (自 C++11 起) |
|
unordered_set
(
unordered_set
&&
other
)
;
|
(11) | (自 C++11 起) |
|
unordered_set
(
unordered_set
&&
other,
const
Allocator
&
alloc
)
;
|
(12) | (自 C++11 起) |
|
unordered_set
(
std::
initializer_list
<
value_type
>
init,
size_type bucket_count
=
/* 未指定 */
,
|
(13) | (自 C++11 起) |
|
unordered_set
(
std::
initializer_list
<
value_type
>
init,
size_type bucket_count,
|
(14) | (自 C++14 起) |
|
unordered_set
(
std::
initializer_list
<
value_type
>
init,
size_type bucket_count,
|
(15) | (自 C++14 起) |
|
template
<
container-compatible-range
<
value_type
>
R
>
unordered_set
(
std::
from_range_t
, R
&&
rg,
|
(16) | (自 C++23 起) |
|
template
<
container-compatible-range
<
value_type
>
R
>
unordered_set
(
std::
from_range_t
, R
&&
rg,
|
(17) | (自 C++23 起) |
|
template
<
container-compatible-range
<
value_type
>
R
>
unordered_set
(
std::
from_range_t
, R
&&
rg,
|
(18) | (自 C++23 起) |
从多种数据源构造新容器。可选择使用用户提供的 bucket_count 作为创建的最小桶数, hash 作为哈希函数, equal 作为键比较函数,以及 alloc 作为分配器。
[
first
,
last
)
中的内容构造容器。将
max_load_factor()
设置为
1.0
。如果范围中有多个元素的键比较等价,则未指定插入哪个元素(待
LWG2844
决议)。
|
模板参数
|
(C++23 起) |
|
模板参数
|
(C++23 起) |
目录参数
复杂度
1-5)
常量。
9,10)
与
other
的大小成线性关系。
11,12)
常量。若
alloc
被指定且
alloc
!
=
other.
get_allocator
(
)
,则为线性复杂度。
异常处理
对
注解在容器移动构造(重载 (4))之后,原先指向 尽管直到 C++23 才正式要求,但一些实现已经在早期模式中将模板参数
示例
缺陷报告以下行为变更缺陷报告被追溯应用于先前发布的C++标准。
另请参阅
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||