deduction guides for
std::set
|
定义于头文件
<set>
|
||
|
template
<
class
InputIt,
|
(1) | (C++17 起) |
|
template
<
class
Key,
class
Comp
=
std::
less
<
Key
>
,
|
(2) | (C++17 起) |
|
template
<
class
InputIt,
class
Alloc
>
set
(
InputIt, InputIt, Alloc
)
|
(3) | (C++17 起) |
|
template
<
class
Key,
class
Alloc
>
set
(
std::
initializer_list
<
Key
>
, Alloc
)
|
(4) | (C++17 起) |
|
template
<
ranges::
input_range
R,
class
Compare
=
less
<
ranges::
range_value_t
<
R
>>
,
class
Alloc
=
std::
allocator
<
ranges::
range_value_t
<
R
>>
>
|
(5) | (C++23 起) |
|
template
<
ranges::
input_range
R,
class
Alloc
>
set
(
std::
from_range_t
, R
&&
, Alloc
)
|
(6) | (C++23 起) |
这些重载仅当满足以下条件时才参与重载决议:
InputIt
满足
LegacyInputIterator
要求,
Alloc
满足
Allocator
要求,且
Comp
不满足
Allocator
要求。
注意:库判定类型不满足
LegacyInputIterator
要求的程度是未指定的,但至少整型类型不符合输入迭代器的条件。同样地,库判定类型不满足
Allocator
要求的程度也是未指定的,但至少要求成员类型
Alloc::value_type
必须存在,且表达式
std::
declval
<
Alloc
&
>
(
)
.
allocate
(
std::
size_t
{
}
)
在被视为未求值操作数时必须良构。
注释
| 功能测试 宏 | 值 | 标准 | 功能 |
|---|---|---|---|
__cpp_lib_containers_ranges
|
202202L
|
(C++23) | 支持范围 的构造与插入;重载 (5,6) |