std::shared_lock<Mutex>::operator=
来自 cppreference.cn
< cpp | thread | shared lock
shared_lock& operator=( shared_lock&& other ) noexcept; |
(自 C++14 起) | |
移动赋值运算符。等效于 shared_lock{std::move(other)}.swap(*this); return *this;。
如果 other 与 *this 是同一对象,则无效果。
否则,如果在调用此函数之前,*this 具有关联的互斥量((mutex() 返回非空指针)并且已获得其所有权(owns() 返回 true),则会通过调用 unlock_shared() 来解锁互斥量。在此调用之后,other 不再具有关联的互斥量。
[编辑] 参数
other | - | 另一个 shared_lock ,用于替换状态 |
[编辑] 返回值
*this
[编辑] 缺陷报告
以下行为变更缺陷报告已追溯应用于先前发布的 C++ 标准。
DR | 应用于 | 已发布行为 | 正确行为 |
---|---|---|---|
LWG 4172 | C++14 | shared_lock 的自移动赋值被错误地指定 |
重新指定为无操作 |