名前空間
変種
操作

std::pair<T1,T2>::operator=

提供: cppreference.com
< cpp‎ | utility‎ | pair
 
 
ユーティリティライブラリ
汎用ユーティリティ
日付と時間
関数オブジェクト
書式化ライブラリ (C++20)
(C++11)
関係演算子 (C++20で非推奨)
整数比較関数
(C++20)
スワップと型操作
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
一般的な語彙の型
(C++11)
(C++17)
(C++17)
(C++17)
(C++17)

初等文字列変換
(C++17)
(C++17)
 
std::pair
メンバ関数
pair::operator=
非メンバ関数
(C++20未満)(C++20未満)(C++20未満)(C++20未満)(C++20未満)(C++20)
(C++11)
推定ガイド(C++17)
ヘルパークラス
(C++11)
 
(1)
pair& operator=( const pair& other );
(C++20未満)
constexpr pair& operator=( const pair& other );
(C++20以上)
(2)
template< class U1, class U2 >
pair& operator=( const pair<U1,U2>& other );
(C++20未満)
template< class U1, class U2 >
constexpr pair& operator=( const pair<U1,U2>& other );
(C++20以上)
(3)
pair& operator=( pair&& other ) noexcept(/* see below */);
(C++11以上)
(C++20未満)
constexpr pair& operator=( pair&& other ) noexcept(/* see below */);
(C++20以上)
(4)
template< class U1, class U2 >
pair& operator=( pair<U1,U2>&& other );
(C++11以上)
(C++20未満)
template< class U1, class U2 >
constexpr pair& operator=( pair<U1,U2>&& other );
(C++20以上)

ペアの内容を置き換えます。

1) コピー代入演算子。 内容を別のペアの内容のコピーで置き換えます。
2) other.firstfirst に、 other.secondsecond に代入します。
3) ムーブ代入演算子。 内容をムーブセマンティクスを用いて other の内容で置き換えます。
4) std::forward<U1>(p.first)first に、 std::forward<U2>(p.second)second に代入します。

以下の条件を満たさない場合、これらの関数の動作は未定義です。

(C++17未満)

これらの関数は、要求される代入演算子が無効な場合、オーバーロード解決に参加しません (または、コピー代入演算子の場合、削除されたものとして定義されます)。 特に、

(C++17以上)

目次

[編集] 引数

other - このペアの内容を置き換える値のペア

[編集] 戻り値

*this

[編集] 例外

1-2) (なし)
3)
noexcept 指定:  
noexcept(

    is_nothrow_move_assignable<T1>::value &&
    is_nothrow_move_assignable<T2>::value

)
4) (なし)

[編集]

[編集] 関連項目