std::unordered_multiset<Key,Hash,KeyEqual,Allocator>:: unordered_multiset
| (1) | ||
|
unordered_multiset
(
)
: unordered_multiset ( size_type ( /* 未指定 */ ) ) { } |
(自 C++11 起)
(直至 C++20) |
|
|
unordered_multiset
(
)
;
|
(自 C++20 起) | |
|
explicit
unordered_multiset
(
size_type bucket_count,
const
Hash
&
hash
=
Hash
(
)
,
|
(2) | (自 C++11 起) |
|
unordered_multiset
(
size_type bucket_count,
const
Allocator
&
alloc
)
|
(3) | (自 C++14 起) |
|
unordered_multiset
(
size_type bucket_count,
const
Hash
&
hash,
|
(4) | (自 C++14 起) |
|
explicit
unordered_multiset
(
const
Allocator
&
alloc
)
;
|
(5) | (自 C++11 起) |
|
template
<
class
InputIt
>
unordered_multiset
(
InputIt first, InputIt last,
|
(6) | (自 C++11 起) |
|
template
<
class
InputIt
>
unordered_multiset
(
InputIt first, InputIt last,
|
(7) | (自 C++14 起) |
|
template
<
class
InputIt
>
unordered_multiset
(
InputIt first, InputIt last,
|
(8) | (自 C++14 起) |
|
unordered_multiset
(
const
unordered_multiset
&
other
)
;
|
(9) | (自 C++11 起) |
|
unordered_multiset
(
const
unordered_multiset
&
other,
const
Allocator
&
alloc
)
;
|
(10) | (自 C++11 起) |
|
unordered_multiset
(
unordered_multiset
&&
other
)
;
|
(11) | (自 C++11 起) |
|
unordered_multiset
(
unordered_multiset
&&
other,
const
Allocator
&
alloc
)
;
|
(12) | (自 C++11 起) |
|
unordered_multiset
(
std::
initializer_list
<
value_type
>
init,
size_type bucket_count
=
/* 未指定 */
,
|
(13) | (自 C++11 起) |
|
unordered_multiset
(
std::
initializer_list
<
value_type
>
init,
size_type bucket_count,
|
(14) | (自 C++14 起) |
|
unordered_multiset
(
std::
initializer_list
<
value_type
>
init,
size_type bucket_count,
|
(15) | (自 C++14 起) |
|
<
|
从多种数据源构造新容器。可选择使用用户提供的 bucket_count 作为创建的最小桶数, hash 作为哈希函数, equal 作为键比较函数, alloc 作为分配器。
|
模板参数
|
(since C++23) |
|
模板参数
|
(C++23 起) |
目录 |
参数
| alloc | - | 用于此容器所有内存分配的分配器 |
| bucket_count | - | 初始化时使用的最小桶数。若未指定,则使用未指定的默认值 |
| hash | - | 要使用的哈希函数 |
| equal | - | 用于此容器所有键比较的比较函数 |
| first, last | - | 定义要复制的元素源 范围 的迭代器对 |
| rg | - |
容器兼容范围
,即元素可转换为
value_type
的
input_range
|
| other | - | 用作源以初始化容器元素的另一容器 |
| init | - | 用于初始化容器元素的初始化列表 |
| 类型要求 | ||
-
InputIt
必须满足
LegacyInputIterator
的要求。
|
||
复杂度
异常
对
Allocator::allocate
的调用可能抛出异常。
注释
尽管在C++23之前没有正式要求,但一些实现在早期模式中已将模板参数
Allocator
置于
非推导上下文
中。
| 功能测试 宏 | 值 | 标准 | 功能特性 |
|---|---|---|---|
__cpp_lib_containers_ranges
|
202202L
|
(C++23) | 支持范围 的构造与插入;重载版本 ( 16-18 ) |
示例
|
本节内容不完整
原因:缺少示例 |
缺陷报告
以下行为变更缺陷报告被追溯应用于先前发布的C++标准。
| 缺陷报告 | 应用于 | 发布时的行为 | 正确行为 |
|---|---|---|---|
| LWG 2193 | C++11 | 默认构造函数 ( 1 ) 为 explicit | 改为 non-explicit |
| LWG 2230 | C++11 | 重载版本 ( 13 ) 的语义未作规定 | 已作规定 |
另请参阅
|
为容器赋值
(公开成员函数) |