← Move Semantics: rvalue References & std::move

Add Move Assignment

medium

b already owns its own array (from its own constructor call) before b = std::move(a); runs – move assignment combines both halves you’ve already written separately: release what b currently owns (like ordinary copy assignment), then steal a’s pointer directly instead of copying it (like the move constructor).

Note the self-assignment guard is still worth keeping even here: x = std::move(x); is unusual but not illegal, and the same reasoning from the copy-assignment lesson applies – check first, before doing anything destructive.

Your solution

"Run" uses the sample stdin ("3 5"). "Submit" checks your code against all 3 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution