std::move_only_function:: move_only_function
|
move_only_function
(
)
noexcept
;
|
(1) | (C++23以降) |
|
move_only_function
(
std::
nullptr_t
)
noexcept
;
|
(2) | (C++23以降) |
|
move_only_function
(
move_only_function
&&
other
)
noexcept
;
|
(3) | (C++23以降) |
|
move_only_function
(
const
move_only_function
&
)
=
delete
;
|
(4) | (C++23以降) |
|
template
<
class
F
>
move_only_function ( F && f ) ; |
(5) | (C++23以降) |
|
template
<
class
T,
class
...
CArgs
>
explicit move_only_function ( std:: in_place_type_t < T > , CArgs && ... args ) ; |
(6) | (C++23以降) |
|
template
<
class
T,
class
U,
class
...
CArgs
>
explicit
move_only_function
(
std::
in_place_type_t
<
T
>
,
|
(7) | (C++23以降) |
新しい
std::move_only_function
を作成します。
std::move_only_function
を構築します。
std::move_only_function
のターゲットが
other
のターゲットであるオブジェクトを構築します。
other
はムーブ構築後、有効だが未規定の状態になります。
VT
を
std::
decay_t
<
F
>
とする。
f
がnull関数ポインタ、nullメンバポインタ値、または空の
std::move_only_function
(他の特殊化でも可)の場合、空の
std::move_only_function
を構築する。それ以外の場合、ターゲットの型が
VT
であり、
std::
forward
<
F
>
(
f
)
で直接非リスト初期化された
std::move_only_function
を構築する。
-
このオーバーロードは、
VTがmove_only_functionと同じではなく、 std::in_place_type_t の特殊化でもなく、かつ /*is-callable-from*/ < VT > (下記参照)が true である場合にのみ、オーバーロード解決に参加する。 - std:: is_constructible_v < VT, F > が true でない場合、プログラムは不適格である。
VT
を
std::
decay_t
<
T
>
とする。
std::move_only_function
を構築し、そのターゲットの型は
VT
であり、
std::
forward
<
CArgs
>
(
args
)
...
で直接非リスト初期化される。
- このオーバーロードは、 std:: is_constructible_v < VT, CArgs... > と /*is-callable-from*/ < VT > (下記参照)の両方が true である場合にのみ、オーバーロード解決に参加する。
-
VTがTと同じ型でない場合、プログラムは不適格である。
VT
を
std::
decay_t
<
T
>
と定義する。
std::move_only_function
を構築し、そのターゲットの型は
VT
であり、
il,
std::
forward
<
CArgs
>
(
args
)
...
で直接非リスト初期化される。
- このオーバーロードは、 std:: is_constructible_v < VT, std:: initializer_list < U > & , CArgs... > と /*is-callable-from*/ < VT > の両方が true である場合にのみ、オーバーロード解決に参加する。
-
VTがTと同じ型でない場合、プログラムは不適格となる。
コンストラクタ
(5-7)
の場合、
VT
が
Destructible
要件を満たさない場合、または
std::
is_move_constructible_v
<
VT
>
が
true
であるにもかかわらず
VT
が
MoveConstructible
要件を満たさない場合、動作は未定義です。
定数
/*is-callable-from*/
<
VT
>
は、
std::move_only_function
のテンプレートパラメータにおける
cv
、
ref
、および
noex
に依存しており、以下の通りです:
| cv ref noexcept ( noex ) | /*呼び出し可能か*/ < VT > |
| noexcept ( false ) |
std::
is_invocable_r_v
<
R, VT, Args...
>
&&
std:: is_invocable_r_v < R, VT & , Args... > |
| noexcept ( true ) |
std::
is_nothrow_invocable_r_v
<
R, VT, Args...
>
&&
std:: is_nothrow_invocable_r_v < R, VT & , Args... > |
| const noexcept ( false ) |
std::
is_invocable_r_v
<
R,
const
VT, Args...
>
&&
std:: is_invocable_r_v < R, const VT & , Args... > |
| const noexcept ( true ) |
std::
is_nothrow_invocable_r_v
<
R,
const
VT, Args...
>
&&
std:: is_nothrow_invocable_r_v < R, const VT & , Args... > |
| & noexcept ( false ) | std:: is_invocable_r_v < R, VT & , Args... > |
| & noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, VT & , Args... > |
| const & noexcept ( false ) | std:: is_invocable_r_v < R, const VT & , Args... > |
| const & noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, const VT & , Args... > |
| && noexcept ( false ) | std:: is_invocable_r_v < R, VT, Args... > |
| && noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, VT, Args... > |
| const && noexcept ( false ) | std:: is_invocable_r_v < R, const VT, Args... > |
| const && noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, const VT, Args... > |
目次 |
パラメータ
| other | - |
別の
std::move_only_function
からムーブする
|
| f | - | ラップする関数または Callable オブジェクト |
| args | - | ターゲットオブジェクトを構築するための引数 |
| il | - | std::initializer_list ターゲットオブジェクトを構築するための |
例外
VT
が関数ポインタ型または
std::reference_wrapper
の特殊化である場合、例外はスローされない。
例
|
このセクションは不完全です
理由: 例がありません |
関連項目
新しい
std::function
インスタンスを構築する
(
std::function<R(Args...)>
の公開メンバ関数)
|
|
新しい
std::copyable_function
オブジェクトを構築する
(
std::copyable_function
の公開メンバ関数)
|