std::experimental::function<R(Args...)>::operator=
|
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) |
| (5) | ||
|
template<
class F
>
function& operator=( std::reference_wrapper<F> f ); |
(库基础 TS) | |
|
template<
class F
>
function& operator=( std::reference_wrapper<F> f ) noexcept; |
(库基础 TS v3) | |
赋值新目标给 std::experimental::function 。在以下描述中,令 ALLOCATOR_OF(f) 为
f 的构造中指定的分配器,或若未指定则为构造时 std::experimental::pmr::get_default_resource()
的值 (库基础
TS v3 前)默认构造的 std::pmr::polymorphic_allocator<>
值 (库基础
TS v3)。
other 的目标到 *this 。
other 在合法状态并拥有未指定值。get_memory_resource()所返回的内存资源等价于赋值前的内存资源,但地址可以更改。f 。此运算符仅若 f 对参数类型
Args... 和返回类型 R 可调用 (Callable)
才参与重载决议。参数
| other | - | 要复制或移动的另一 std::experimental::function 对象
|
| f | - | 要用以初始化目标的可调用对象 |
| 类型要求 | ||
-F
必须符合可调用
(Callable)
的要求。
|
||
返回值
*this
异常
注解
若 get_memory_resource() != other.get_memory_resource() (库基础 TS v3 前)get_allocator() != other.get_allocator() (库基础 TS v3) 则移动赋值运算符可能需要分配存储。