std::experimental::function<R(Args...)>::operator=
来自cppreference.com
< cpp | experimental | function
| function& operator=( const function& other ); |
(1) | (库基础 TS) |
| function& operator=( function&& other ); |
(2) | (库基础 TS) |
| function& operator=( std::nullptr_t ) noexcept; |
(3) | (库基础 TS) |
| template< class F > function& operator=( F&& f ); |
(4) | (库基础 TS) |
| template< class F > function& operator=( std::reference_wrapper<F> f ); |
(5) | (库基础 TS) |
赋值新目标给 std::experimental::function 。在以下描述中,令 ALLOCATOR_OF(f) 为 f 的构造中指定的分配器,或若未指定则为构造时 std::experimental::pmr::get_default_resource() 的值。
2) 如同以执行 function(std::allocator_arg, ALLOCATOR_OF(*this), std::move(other)).swap(*this); 移动
other 的目标到 *this 。 other 在合法状态并拥有未指定值。3) 销毁 *this 的目标。调用后 *this 为空。赋值后
get_memory_resource()所返回的内存资源等价于赋值前的内存资源,但地址可以更改。4) 如同通过执行 function(std::allocator_arg, ALLOCATOR_OF(*this),std::forward<F>(f)).swap(*this); 设置 *this 的目标为
f 。此运算符仅若 f 对参数类型 Args... 和返回类型 R 可调用 (Callable) 才参与重载决议。参数
| other | - | 要复制或移动的另一 std::experimental::function 对象
|
| f | - | 要用以初始化目标的可调用对象 |
| 类型要求 | ||
-F 必须满足可调用 (Callable) 的要求。
| ||
返回值
*this
异常
1-2,4-5) (无)