Namespaces
Variants
Actions

std::experimental::unique_resource<R, D>::operator=

From cppreference.com
 
C++
 
Experimental
Technical Specification
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Experimental Non-TS
Pattern Matching
Linear Algebra
std::execution
Contracts
2D Graphics
 
Library fundamentals v3
 
std::experimental::unique_resource
unique_resource& operator=( unique_resource&& other )
    noexcept(/*see below*/);
(library fundamentals TS v3)

Move assignment operator. Replaces the managed resource and the deleter with other's.

Formally, let RS be the type of stored resource handle:

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.

Contents

[edit] Parameters

other - resource wrapper from which ownership will be transferred

[edit] Return value

*this

[edit] Exceptions

Any exception thrown in copy-assignment.

[edit] Notes

If a copy of a member throws an exception, this mechanism leaves other intact and *this in the released state.

[edit] Example

[edit] See also

disposes or replaces the managed resource
(public member function) [edit]
assigns the unique_ptr
(public member function of std::unique_ptr<T,Deleter>) [edit]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant