std::function_ref::operator=
来自 cppreference.cn
< cpp | 工具 | 函数对象 | 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` 对象 (public 成员函数) | |
替换或销毁目标 ( std::copyable_function 的 public 成员函数) | |
赋值一个新的目标 ( std::function<R(Args...)> 的 public 成员函数) | |
替换或销毁目标 ( std::move_only_function 的 public 成员函数) |