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_lockinstance. Ifotherowned a lock on a mutex prior to the constructor invocation, that lock is now owned by the newly-createdstd::unique_lockobject.- Postconditions:
For a newly-constructed
std::unique_lockobjectx,x.mutex()is equal to the value ofother.mutex()prior to the constructor invocation, andx.owns_lock()is equal to the value ofother.owns_lock()prior to the constructor invocation.other.mutex()==NULL,other.owns_lock()==false.- Throws:
Nothing
- Note:
std::unique_lockobjects are notCopyConstructible, so there is no copy-constructor, only this move constructor
Header
#include <mutex>