std::unique...k::operator=(3)
okay bestie, welcome to std::unique...k::operator=(3) from the C++ Standard Libary manual β yes, the manual name says Libary in the header, and we are not fixing it, that's canon π
.
π NAME π
std::unique_lock::operator=β literallystd::unique_lock::operator=, the move assignment operator, here to replace contents and serve move-semantics realness π«Ά
β¨ Synopsis β¨
unique_lock& operator=( unique_lock&& other ); (since C++11)
Move assignment operator energy: it replaces the contents with those of other using move semantics. no cap, that's the whole job π«
β οΈ important vibe check: if, prior to the call, *this has an associated mutex and has acquired ownership of it, the mutex is unlocked.
π Parameters π
otherβ anotherunique_lockto replace the state with. that's it, that's the parameter π«Ά
πΈ Return value πΈ
*thisβ yes queen, it returns itself π
π₯ Exceptions π₯
Throws nothing. literally nothing. silence. π
but bestie, there's defect-report lore below, so don't stop reading π
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR:
LWG 2104- Applied to:
C++11 - Behavior as published: the move assignment operator was
noexcept, but it may throw an exception in the case of undefined behavior^[1] - Correct behavior: it is not
noexcept
- Applied to:
- β For example,
*thisis constructed withstd::adopt_lock, but the calling thread does not have the ownership of the associated mutex. In this case,*thiscannot properly release the ownership of the associated mutex, and it may result in an exception to be thrown.
okay that's the whole page, bestie β source: http://cppreference.com, version/date: 2024.06.10, page: std::unique...k::operator=(3). go forth and move-assign responsibly πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms