Documentation Home

Transfers ownership of a shared-ownership lock from one std::shared_lock object to a newly-created std::shared_lock object.

shared_lock(shared_lock&& other);

Effects:

Constructs a std::shared_lock instance. If other owned a lock on a mutex prior to the constructor invocation, that lock is now owned by the newly-created std::shared_lock object.

Postconditions:

For a newly-constructed std::shared_lock object x, x.mutex() is equal to the value of other.mutex() prior to the constructor invocation, and x.owns_lock() is equal to the value of other.owns_lock() prior to the constructor invocation. other.mutex()==NULL, other.owns_lock()==false.

Throws:

Nothing

Note:

std::shared_lock objects are not CopyConstructible, so there is no copy-constructor, only this move constructor

Header

#include <shared_mutex>

See Also