deduction guides for
std::multiset
|
定義済みヘッダー
<set>
|
||
|
template
<
class
InputIt,
|
(1) | (C++17以降) |
|
template
<
class
Key,
class
Comp
=
std::
less
<
Key
>
,
|
(2) | (C++17以降) |
|
template
<
class
InputIt,
class
Alloc
>
multiset
(
InputIt, InputIt, Alloc
)
|
(3) | (C++17以降) |
|
template
<
class
Key,
class
Alloc
>
multiset
(
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
>
multiset
(
std::
from_range_t
, R
&&
, Alloc
)
|
(6) | (C++23以降) |
multiset
に対してイテレータ範囲(オーバーロード
(1,3)
)および
std::initializer_list
(オーバーロード
(2,4)
)からの推論を可能にするために提供されています。
これらのオーバーロードは、以下の条件が満たされる場合にのみオーバーロード解決に参加します:
InputIt
が
LegacyInputIterator
を満たし、
Alloc
が
Allocator
を満たし、かつ
Comp
が
Allocator
を満たさない場合です。
注意: ライブラリが型が
LegacyInputIterator
を満たさないと判断する範囲は未規定であるが、少なくとも整数型は入力イテレータとして適格ではない。同様に、型が
Allocator
を満たさないと判断する範囲も未規定であるが、少なくともメンバ型
Alloc::value_type
が存在しなければならず、式
std::
declval
<
Alloc
&
>
(
)
.
allocate
(
std::
size_t
{
}
)
が未評価オペランドとして扱われた際に well-formed でなければならない。
注記
| 機能テスト マクロ | 値 | 標準 | 機能 |
|---|---|---|---|
__cpp_lib_containers_ranges
|
202202L
|
(C++23) | Ranges-aware 構築と挿入; オーバーロード (5,6) |
例
#include <set> int main() { // ガイド #2 は std::multiset<int> を推論 std::multiset s = {1, 2, 3, 4}; // ガイド #1 は std::multiset<int> を推論 std::multiset s2(s.begin(), s.end()); }