std::experi...e::operator=(3)
π NAME π
okay bestie, welcome to the C++ Standard Libary manual page for std::experimental::unique_resource::operator= β the page title is literally std::experi...e::operator=(3) and yes they abbreviated it, iconic behavior. The full name situation is:
std::experimental::unique_resource::operator= β std::experimental::unique_resource::operator=
β¨ Synopsis β¨
here's the signature, no cap:
unique_resource& operator=( unique_resource&& other ) (library fundamentals TS v3)
noexcept(/*see below*/);
it's giving move assignment operator energy, and it's from the library fundamentals TS v3 β¨
so what does it actually do? Move assignment operator. It replaces the managed resource and the deleter with other's.
Formally, let RS be the type of stored resource handle:
- First, calls
reset()to dispose the currently owned resource, if any. - Then assigns the stored resource handle and the deleter with
other's.std::moveis applied to the stored resource handle or the deleter ofotherifstd::is_nothrow_move_assignable_v<RS>orstd::is_nothrow_move_assignable_v<D>istruerespectively. Assignment of the stored resource handle is executed first, unlessstd::is_nothrow_move_assignable_v<D>isfalseandstd::is_nothrow_move_assignable_v<RS>istrue. - Finally, sets
*thisto own the resource if and only ifotherowned it before assignment, andothernot to own the resource.
If std::is_nothrow_move_assignable_v<RS> is true, RS shall satisfy the MoveAssignable requirements; otherwise RS shall satisfy the CopyAssignable requirements. If std::is_nothrow_move_assignable_v<D> is true, D shall satisfy the MoveAssignable requirements; otherwise D shall satisfy the CopyAssignable requirements. Failing to satisfy above requirements results in undefined behavior π±π
π Parameters π
otherβ resource wrapper from which ownership will be transferred π«Ά
π Return value π
it returns *this. periodt. π
π₯ Exceptions π₯
Any exception thrown in copy-assignment.
noexcept specification:
noexcept(std::is_nothrow_move_assignable_v<RS> &&
std::is_nothrow_move_assignable_v<D>)
π§ Notes π§
If a copy of a member throws an exception, this mechanism leaves other intact and *this in the released state. bestie behavior honestly π§β¨
π Example π
This section is incomplete
Reason: no example
π See also π
resetβ disposes or replaces the managed resource (public member function)operator=β assigns theunique_ptr(public member function ofstd::unique_ptr<T,Deleter>)
πΈ Categories πΈ
- conditionally noexcept
- Todo no example
that's the whole page, bestie! sourced from http://cppreference.com, dated 2024.06.10, page std::experi...e::operator=(3) β slay and stay hydrated ππ«Άβ¨
π¦ 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