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