std::function_ref:: operator=
From cppreference.net
<
cpp
|
utility
|
functional
|
function ref
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function objects
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::function_ref
| Member functions | ||||
|
function_ref::operator=
|
||||
| Deduction guides |
|
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
的公开成员函数)
|