Namespaces
Variants

std::flat_set<Key,Compare,KeyContainer>:: flat_set

From cppreference.net

flat_set ( )
: flat_set ( key_compare ( ) ) { }
(1) (C++23以降)
template < class Allocator >
flat_set ( const flat_set & other, const Allocator & alloc ) ;
(2) (C++23以降)
template < class Allocator >
flat_set ( flat_set && other, const Allocator & alloc ) ;
(3) (C++23以降)
explicit flat_set ( container_type cont,
const key_compare & comp = key_compare ( ) ) ;
(4) (C++23以降)
template < class Allocator >
flat_set ( const container_type & cont, const Allocator & alloc ) ;
(5) (C++23以降)
template < class Allocator >

flat_set ( const container_type & cont, const key_compare & comp,

const Allocator & alloc ) ;
(6) (C++23以降)
flat_set ( std:: sorted_unique_t s, container_type cont,

const key_compare & comp = key_compare ( ) )

: c ( std :: move ( cont ) ) , compare ( comp ) { }
(7) (C++23以降)
template < class Allocator >

flat_set ( std:: sorted_unique_t s, const container_type & cont,

const Allocator & alloc ) ;
(8) (C++23以降)
template < class Allocator >

flat_set ( std:: sorted_unique_t s, const container_type & cont,

const key_compare & comp, const Allocator & alloc ) ;
(9) (C++23以降)
explicit flat_set ( const key_compare & comp )
: c ( ) , compare ( comp ) { }
(10) (C++23以降)
template < class Allocator >
flat_set ( const key_compare & comp, const Allocator & alloc ) ;
(11) (C++23以降)
template < class Allocator >
explicit flat_set ( const Allocator & alloc ) ;
(12) (C++23以降)
template < class InputIter >

flat_set ( InputIter first, InputIter last,
const key_compare & comp = key_compare ( ) )

: c ( ) , compare ( comp ) ;
(13) (C++23以降)
template < class InputIter, class Allocator >

flat_set ( InputIter first, InputIter last,

const key_compare & comp, const Allocator & alloc ) ;
(14) (C++23以降)
template < class InputIter, class Allocator >
flat_set ( InputIter first, InputIter last, const Allocator & alloc ) ;
(15) (C++23以降)
template < container-compatible-range < value_type > R >

flat_set ( std:: from_range_t , R && rg, const key_compare & comp )

: flat_set ( comp ) ;
(16) (C++23以降)
template < container-compatible-range < value_type > R >

flat_set ( std:: from_range_t fr, R && rg )

: flat_set ( fr, std:: forward < R > ( rg ) , key_compare ( ) ) { }
(17) (C++23以降)
template < container-compatible-range < value_type > R, class Allocator >
flat_set ( std:: from_range_t , R && rg, const Allocator & alloc ) ;
(18) (C++23以降)
template < container-compatible-range < value_type > R, class Allocator >

flat_set ( std:: from_range_t , R && rg, const key_compare & comp,

const Allocator & alloc ) ;
(19) (C++23以降)
template < class InputIter >

flat_set ( std:: sorted_unique_t s, InputIter first, InputIter last,
const key_compare & comp = key_compare ( ) )

: c ( first, last ) , compare ( comp ) { }
(20) (C++23以降)
template < class InputIter, class Allocator >

flat_set ( std:: sorted_unique_t s, InputIter first, InputIter last,

const key_compare & comp, const Allocator & alloc ) ;
(21) (C++23以降)
template < class InputIter, class Allocator >

flat_set ( std:: sorted_unique_t s, InputIter first, InputIter last,

const Allocator & alloc ) ;
(22) (C++23以降)
flat_set ( std:: initializer_list < value_type > init,

const key_compare & comp = key_compare ( ) )

: flat_set ( init. begin ( ) , init. end ( ) , comp ) { }
(23) (C++23以降)
template < class Allocator >

flat_set ( std:: initializer_list < value_type > init, const key_compare & comp,

const Allocator & alloc ) ;
(24) (C++23以降)
template < class Allocator >
flat_set ( std:: initializer_list < value_type > init, const Allocator & alloc ) ;
(25) (C++23以降)
flat_set ( std:: sorted_unique_t s, std:: initializer_list < value_type > init,

const key_compare & comp = key_compare ( ) )

: flat_set ( s, init. begin ( ) , init. end ( ) , comp ) { }
(26) (C++23以降)
template < class Allocator >

flat_set ( std:: sorted_unique_t s, std:: initializer_list < value_type > init,

const key_compare & comp, const Allocator & alloc ) ;
(27) (C++23以降)
template < class Allocator >

flat_set ( std:: sorted_unique_t s, std:: initializer_list < value_type > init,

const Allocator & alloc ) ;
(28) (C++23以降)

様々なデータソースから新しいコンテナアダプタを構築し、オプションで比較関数オブジェクト comp および/またはアロケータ alloc を提供します。

1) デフォルトコンストラクタ。空のコンテナアダプタを構築します。
2) コピーコンストラクタ。 copy constructor c other. c の内容のコピーで構築し、 compare other. compare で構築する。 以下の allocator usage note を参照。
3) ムーブコンストラクタ。コンテナアダプタを other の内容でムーブセマンティクスを使用して構築します。 以下の アロケータ使用上の注意 を参照してください。
4) 基となるコンテナをコンテナ cont の内容で構築します。まず、 c std :: move ( cont ) で初期化し、 compare comp で初期化します。その後、 c comp に関してソートします。最後に、要素を一意にし、つまり連続する同等の要素のグループから最初の要素以外をすべて削除します。
5) (4) と同様、 flat_set ( cont ) ; と同等です。 以下の アロケータ使用上の注意 を参照してください。
6) (4) と同様、 flat_set ( cont, comp ) ; と同等です。 以下の アロケータ使用上の注意 を参照してください。
7) 基となるコンテナを他のコンテナ cont の内容で構築します。 c std :: move ( cont ) で初期化し、 compare comp で初期化します。
8) (7) と同様、 flat_set ( s, cont ) ; と同等。 以下の アロケータ使用上の注意 を参照。
9) (7) と同じ、次と等価: flat_set ( s, cont, comp ) ; . 以下の アロケータ使用上の注意 を参照。
10) 空のコンテナアダプタを構築します。
11,12) 空のコンテナアダプタを構築します。 以下の allocator usage note を参照してください。
13) コンテナアダプタを範囲 [ first , last ) の内容で構築します。これは insert ( first, last ) ; と等価です。
14,15) (13) と同じ。 以下 allocator usage note を参照。
16) 範囲 rg の内容でコンテナアダプタを構築します。まず、 (10) 委譲コンストラクタ として使用します。その後、 c rg の内容で初期化します。これは insert_range ( std:: forward < R > ( rg ) ) ; によって行われるかのように動作します。
17) (16) と同様に、 delegating constructor として使用する。
18,19) (16) と同じ。 以下 allocator usage note を参照。
20) 基となるコンテナを範囲 [ first , last ) の内容で構築します。 c c ( first, last ) で初期化し、 compare compare ( comp ) で初期化します。
21,22) (20) と同じ。 以下 allocator usage note を参照。
23) 初期化リストコンストラクタ。基底コンテナを初期化リスト init の内容で構築し、 (13) デリゲーティングコンストラクタ として使用します。
24,25) (23) と同じです。 以下の allocator usage note を参照してください。
26) 初期化子リストコンストラクタ。 initializer-list constructor 初期化子リスト init の内容で基盤となるコンテナを構築し、 (20) delegating constructor として使用します。
27,28) (26) として保存。 以下 allocator usage note を参照。

オーバーロードに関する注記 (13-15,20-22) : [ first , last ) 有効な範囲 でない場合、動作は未定義です。

Note for overloads (4-6,13-19,23-25) : If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted (pending LWG2844 (注:元のテキスト「LWG2844」はC++固有の用語(LWG = Library Working Group)であり、翻訳対象外のため変更していません) ).

目次

アロケータ使用上の注意

コンストラクタ (2,3,5,6,8,9,11,12,14,15,17,19,21,22,24,25,27,28) は、対応する非アロケータコンストラクタと同等ですが、 c 使用アロケータ構築 で構築される点が異なります。 これらのオーバーロードは、 std:: uses_allocator_v < container_type, Allocator > true の場合にのみオーバーロード解決に参加します。

パラメータ

cont - 基盤となるコンテナを初期化するためのソースとして使用するコンテナ
other - 基盤となるコンテナの要素を初期化するためのソースとして使用する別の flat_set
alloc - 基盤となるコンテナの全てのメモリ割り当てに使用するアロケータ
comp - キーの全ての比較に使用する関数オブジェクト
first, last - コピーする要素のソース 範囲 を定義するイテレータのペア
init - 基盤となるコンテナの要素を初期化するための初期化子リスト
rg - 基盤となるコンテナを初期化するためのソースとして使用する コンテナ互換範囲 (つまり、 input_range であり、その要素が value_type に変換可能なもの)
fr - 含まれるメンバーが範囲構築されるべきであることを示す 曖昧性解消タグ
s - 入力シーケンスが compare に関してソートされており、全ての要素が一意であることを示す 曖昧性解消タグ
型要件
-
InputIt LegacyInputIterator の要件を満たさなければならない。
-
Compare Compare の要件を満たさなければならない。
-
Allocator Allocator の要件を満たさなければならない。

計算量

1) 定数。
2) サイズは other に対して線形。
3) ラップされたコンテナの対応するムーブコンストラクタと同じ、すなわち cont のサイズに対して定数時間または線形時間。
4-6) N に対して線形( cont compare に関してソートされている場合)、それ以外の場合は 𝓞(N·log(N)) 。ここで N はこの呼び出し前の cont. size ( ) の値。
7-9) ラップされたコンテナの対応するムーブコンストラクタと同じ、すなわち cont のサイズに対して定数時間または線形時間。
10-12) 定数。
13-15) 入力範囲 [ first , last ) compare に関してソートされている場合は N に対して線形、それ以外の場合は 𝓞(N·log(N)) 。ここで N はこの呼び出し前の cont. size ( ) の値。
16-19) 入力範囲 rg compare に関してソートされている場合は N に対して線形、それ以外の場合は 𝓞(N·log(N)) 。ここで N はこの呼び出し前の cont. size ( ) の値。
20-22) [ first , last ) のサイズに対して線形。
23-25) N に対して線形( init の要素が compare に関してソートされている場合)、それ以外の場合は 𝓞(N·log(N)) 。ここで N はこの呼び出し前の cont. size ( ) の値。
26-28) サイズに対して線形 init .

例外

Allocator::allocate の呼び出しは例外をスローする可能性があります。

注記

コンテナのムーブ構築後(オーバーロード ( 3 ) )、 other への参照、ポインタ、およびイテレータ(終端イテレータを除く)は有効なままですが、現在は * this 内の要素を参照します。現在の標準では、この保証は [container.reqmts]/67 の包括的な記述によって行われており、より直接的な保証は LWG issue 2321 を通じて検討中です。

関連項目

コンテナアダプタに値を代入する
(公開メンバ関数)