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 に対して提供されます。これらのオーバーロードは、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対応の構築と挿入。オーバーロード (5,6) |
[編集] 例
#include <set> int main() { // guide #2 deduces std::multiset<int> std::multiset s = {1, 2, 3, 4}; // guide #1 deduces std::multiset<int> std::multiset s2(s.begin(), s.end()); }