◐ Shell
clean mode source ↗

std::shared_lock<Mutex>::operator= - cppreference.com

From cppreference.com

shared_lock& operator=( shared_lock&& other ) noexcept;
(since C++14)

Move assignment operator. Equivalent to shared_lock{std::move(other)}.swap(*this); return *this;.

If other is the same object as *this, there is no effect.

Otherwise, if prior to this call *this has an associated mutex ((mutex() returns a non-null pointer) and has acquired ownership of it (owns() returns true), the mutex is unlocked by calling std::shared_mutex::unlock_shared. After this call, other has no associated mutex.

Parameters

other - another shared_lock to replace the state with

Return value

*this

Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
LWG 4172 C++14 self-move-assignment of shared_lock was incorrectly specified respecified as no-op