Namespaces
Variants

std::shared_lock<Mutex>:: operator=

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
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 の自己ムーブ代入が誤って規定されていた 何もしない操作として再規定