名前空間
変種
操作

std::set<Key,Compare,Allocator>::merge

提供: cppreference.com
< cpp‎ | container‎ | set
 
 
 
 
template<class C2>
void merge(std::set<Key, C2, Allocator>& source);
(1) (C++17以上)
template<class C2>
void merge(std::set<Key, C2, Allocator>&& source);
(2) (C++17以上)
template<class C2>
void merge(std::multiset<Key, C2, Allocator>& source);
(3) (C++17以上)
template<class C2>
void merge(std::multiset<Key, C2, Allocator>&& source);
(4) (C++17以上)

source からの要素の抽出 (スプライシング) と、 *this の比較関数オブジェクトを使用したその要素の *this への挿入を試みます。 source の持つ要素のキーと同等のキーを持つ要素が *this にある場合、その要素は source から抽出されません。 要素はコピーもムーブもされません。 コンテナのノードの内部ポインタが指し変えられるだけです。 転送される要素を指すすべてのポインタと参照は有効なままですが、 source ではなく *this 内を指すようになります。

get_allocator() != source.get_allocator() の場合、動作は未定義です。

目次

[編集] 引数

source - ノード転送元の互換なコンテナ

[編集] 戻り値

(なし)

例外

比較関数が例外を投げない限り、例外を投げることはありません。

[編集] 計算量

N*log(size()+N))、ただし N は source.size() です。

[編集]

[編集] 関連項目

(C++17)
コンテナからノードを抽出します
(パブリックメンバ関数) [edit]
要素またはノード (C++17以上)を挿入します
(パブリックメンバ関数) [edit]