std::function<R(Args...)>::assign
来自cppreference.com
< cpp | utility | functional | function
工具库
函数对象
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
旧绑定器与适配器 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
std::function
成员函数 | ||||
function::assign
(C++17
前)
|
||||
非成员函数 | ||||
(C++20
前)
|
||||
辅助类 | ||||
(C++17
前)
|
||||
推导指引(C++17) |
template<
class
F, class
Alloc >
void assign( F&& f, const Alloc& alloc ); |
(C++11
起) (C++17 中移除) |
|
以目标初始化 f
。用 alloc
为 function
会使用的任何内部数据结构分配内存。
等价于 function(std::allocator_arg, alloc, std::forward<F>(f)).swap(*this); 。
参数
f | - | 用以初始化目标的可调用函数 |
alloc | - | 用于为内部数据结构分配内存的分配器 |
返回值
(无)
异常
可能会抛出由实现定义的异常。
参阅
为内容赋值 (公开成员函数) |