Documentation Home >> Headers >> <mutex> Header >> std::unique_lock >> std::unique_lock Move-Constructor

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

unique_lock(unique_lock&& other);

Effects:

Constructs a std::unique_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::unique_lock object.

Postconditions:

For a newly-constructed std::unique_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::unique_lock objects are not CopyConstructible, so there is no copy-constructor, only this move constructor

Header

#include <mutex>

See Also