std::unordered_multiset の推論ガイド
| ヘッダー <unordered_set> で定義 |
||
| template< class InputIt, |
(1) | (C++17以降) |
| template< class T, class Hash = std::hash<T>, |
(2) | (C++17以降) |
| template< class InputIt, class Alloc > unordered_multiset( InputIt, InputIt, typename /* see below */::size_type, Alloc ) |
(3) | (C++17以降) |
| template< class InputIt, class Hash, class Alloc > unordered_multiset( InputIt, InputIt, typename /* see below */::size_type, Hash, Alloc ) |
(4) | (C++17以降) |
| template< class T, class Alloc > unordered_multiset( std::initializer_list<T>, typename /* see below */::size_type, Alloc ) |
(5) | (C++17以降) |
| template< class T, class Hash, class Alloc > unordered_multiset( std::initializer_list<T>, typename /* see below */::size_type, |
(6) | (C++17以降) |
| template< ranges::input_range R, class Hash = std::hash<ranges::range_value_t<R>>, |
(7) | (C++23から) |
| template< ranges::input_range R, class Alloc > unordered_multiset( std::from_range_t, R&&, |
(8) | (C++23から) |
| template< ranges::input_range R, class Alloc > unordered_multiset( std::from_range_t, R&&, Alloc ) |
(9) | (C++23から) |
| template< ranges::input_range R, class Hash, class Alloc > unordered_multiset( std::from_range_t, R&&, |
(10) | (C++23から) |
unordered_multiset がイテレータ範囲(オーバーロード (1,3,4))および std::initializer_list(オーバーロード (2,5,6))から推論できるように提供されます。このオーバーロードは、InputIt が LegacyInputIterator を満たし、Alloc が Allocator を満たし、Hash と Pred のどちらも Allocator を満たさず、Hash が整数型ではない場合にのみ、オーバーロード解決に参加します。注:ライブラリが型が LegacyInputIterator を満たさないと判断する程度は未指定です。ただし、最低限、整数型は入力イテレータとして適格ではありません。同様に、型が Allocator を満たさないと判断する程度は未指定です。ただし、最低限、メンバ型 Alloc::value_type が存在し、式 std::declval<Alloc&>().allocate(std::size_t{}) が評価されないオペランドとして扱われる場合に、well-formed である必要があります。
これらのガイドにおける size_type パラメータ型は、推論ガイドによって推論された型の size_type メンバ型を参照します。
[編集] 注釈
| 機能テストマクロ | 値 | 規格 | 機能 |
|---|---|---|---|
__cpp_lib_containers_ranges |
202202L |
(C++23) | 範囲対応の構築および挿入。オーバーロード (7-10) |
[編集] 例
#include <unordered_set> int main() { // guide #2 deduces std::unordered_multiset<int> std::unordered_multiset s = {1, 2, 3, 4}; // guide #1 deduces std::unordered_multiset<int> std::unordered_multiset s2(s.begin(), s.end()); }