Namespaces
Variants

std::function<R(Args...)>:: assign

From cppreference.net
Utilities library
Function objects
Function invocation
(C++17) (C++23)
Identity function object
(C++20)
Old binders and adaptors
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
( until C++17* ) ( until C++17* )
( until C++17* ) ( until C++17* )

( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
template < class F, class Alloc >
void assign ( F && f, const Alloc & alloc ) ;
(C++11 以降)
(C++17 で削除)

target f で初期化します。 alloc は、 function が使用する可能性のある内部データ構造のメモリ割り当てに使用されます。

function ( std:: allocator_arg , alloc, std:: forward < F > ( f ) ) . swap ( * this ) ; と等価です。

目次

パラメータ

f - target を初期化するための呼び出し可能な関数
alloc - 内部データ構造用にメモリを割り当てるために使用するアロケータ

戻り値

(なし)

例外

実装定義の例外をスローする可能性があります。

関連項目

新しいターゲットを割り当てる
(公開メンバ関数)