std::function_ref::operator=
来自 cppreference.cn
< cpp | utility | functional | function ref
constexpr function_ref& operator=( const function_ref& ) noexcept = default; |
(1) | (自 C++26 起) |
template< class T > constexpr function_ref& operator=( T ) = delete; |
(2) | (自 C++26 起) |
1) 复制赋值运算符被显式预置。
std::function_ref
满足 copyable
和 TriviallyCopyable。此默认赋值运算符执行对存储的 thunk-ptr
和 bound-entity
的浅复制。2) 如果 T 不是与
std::function_ref
相同的类型,std::is_pointer_v<T> 为 false,且 T 不是 std::nontype_t 的特化,则用户定义的赋值运算符被显式删除。仅当上述条件满足约束时,此重载才参与重载决议。[编辑] 返回值
*this
[编辑] 参见
构造新的 function_ref 对象(公开成员函数) | |
替换或销毁目标 ( std::copyable_function 的公开成员函数) | |
赋值新的目标 ( std::function<R(Args...)> 的公开成员函数) | |
替换或销毁目标 ( std::move_only_function 的公开成员函数) |