diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2021-10-28 03:52:21 -0400 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2021-10-28 03:52:21 -0400 |
commit | 189927c237cc4cfd38af2da5f25891c30d84e6dc (patch) | |
tree | cb4bb570f51aed39c4242d39ad68c0f3accaf9ed | |
parent | 40c8a8c6271b2f80bf8cb73e00daf2203640d41a (diff) |
hle/result: Add move assignment operator in ResultVal
ResultVal was missing a move assignment operator, add it.
-rw-r--r-- | src/core/hle/result.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index a755008d5..ffef46794 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -244,6 +244,26 @@ public: return *this; } + ResultVal& operator=(ResultVal&& o) { + if (this == &o) { + return *this; + } + if (!empty()) { + if (!o.empty()) { + object = std::move(o.object); + } else { + object.~T(); + } + } else { + if (!o.empty()) { + new (&object) T(std::move(o.object)); + } + } + result_code = o.result_code; + + return *this; + } + /** * Replaces the current result with a new constructed result value in-place. The code must not * be an error code. |