命名空间
变体
操作

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

来自 cppreference.cn
< cpp‎ | utility‎ | functional‎ | function
 
 
 
函数对象
函数调用
(C++17)(C++23)
恒等函数对象
(C++20)
透明运算符包装器
(C++14)
(C++14)
(C++14)
(C++14)  
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)

旧式绑定器和适配器
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)  
(直到 C++17*)
(直到 C++17*)(直到 C++17*)(直到 C++17*)(直到 C++17*)
(直到 C++20*)
(直到 C++20*)
(直到 C++17*)(直到 C++17*)
(直到 C++17*)(直到 C++17*)

(直到 C++17*)
(直到 C++17*)(直到 C++17*)(直到 C++17*)(直到 C++17*)
(直到 C++20*)
(直到 C++20*)
 
 
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 - 用于为内部数据结构分配内存的分配器

[编辑] 返回值

(无)

[编辑] 异常

可能抛出实现定义的异常。

[编辑] 参见

赋值新的目标
(公共成员函数) [编辑]