std::copyable_function:: operator=
From cppreference.net
<
cpp
|
utility
|
functional
|
copyable function
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function objects
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
copyable_function
&
operator
=
(
const
copyable_function
&
other
)
;
|
(1) | (C++26以降) |
|
copyable_function
&
operator
=
(
copyable_function
&&
other
)
;
|
(2) | (C++26以降) |
|
copyable_function
&
operator
=
(
std::
nullptr_t
)
noexcept
;
|
(3) | (C++26以降) |
|
template
<
class
F
>
copyable_function & operator = ( F && f ) ; |
(4) | (C++26以降) |
std::copyable_function
に新しいターゲットを割り当てるか、そのターゲットを破棄します。
1)
other
のターゲットのコピーを
*
this
に代入する。これは
auto
(
other
)
.
swap
(
*
this
)
を実行する場合と同様である。
2)
other
のターゲットを
*
this
に移動する、または
other
が空の場合
*
this
のターゲット(存在する場合)を破棄する。これは
auto
(
std
::
move
(
other
)
)
.
swap
(
*
this
)
によって行われる。
other
はムーブ代入後、不定値を持つ有効な状態となる。
3)
現在のターゲットが存在する場合、それを破棄します。
*
this
は呼び出し後に空になります。
4)
*
this
のターゲットを呼び出し可能な
f
に設定する。または、
f
がnull関数ポインタ、nullメンバ関数ポインタ、または空の
std::copyable_function
である場合、現在のターゲットを破棄する。これは
copyable_function
(
std::
forward
<
F
>
(
f
)
)
.
swap
(
*
this
)
;
を実行するのと同様である。このオーバーロードは、
copyable_function
の
F
からのコンストラクタがオーバーロード解決に参加する場合にのみ、オーバーロード解決に参加する。選択されたコンストラクタ呼び出しが不適格または未定義動作を持つ場合、プログラムは不適格または未定義動作を持つ。
目次 |
パラメータ
| other | - |
コピーまたは移動する対象となる別の
std::copyable_function
オブジェクト
|
| f | - | 新しいターゲットを初期化するための呼び出し可能オブジェクト |
戻り値
* this
例
|
このセクションは不完全です
理由: 例がありません |
関連項目
|
新しいターゲットを割り当てる
(
std::function<R(Args...)>
の公開メンバ関数)
|
|
|
ターゲットを置き換えるか破棄する
(
std::move_only_function
の公開メンバ関数)
|