diff options
author | bunnei <bunneidev@gmail.com> | 2021-10-29 18:14:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 18:14:32 +0200 |
commit | c1b199bd21d32a20fead3d157f9e01f92534af77 (patch) | |
tree | 4f90a24e7569d8ea5d93ffd028cf19171367f45f /src/core | |
parent | Merge pull request #7243 from lat9nq/nvdrv-warn (diff) | |
parent | hle/result: Declare copy/move constructor/assignment as noexcept (diff) | |
download | yuzu-c1b199bd21d32a20fead3d157f9e01f92534af77.tar yuzu-c1b199bd21d32a20fead3d157f9e01f92534af77.tar.gz yuzu-c1b199bd21d32a20fead3d157f9e01f92534af77.tar.bz2 yuzu-c1b199bd21d32a20fead3d157f9e01f92534af77.tar.lz yuzu-c1b199bd21d32a20fead3d157f9e01f92534af77.tar.xz yuzu-c1b199bd21d32a20fead3d157f9e01f92534af77.tar.zst yuzu-c1b199bd21d32a20fead3d157f9e01f92534af77.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/result.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index a755008d5..00fe70998 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -206,7 +206,7 @@ public: return result; } - ResultVal(const ResultVal& o) : result_code(o.result_code) { + ResultVal(const ResultVal& o) noexcept : result_code(o.result_code) { if (!o.empty()) { new (&object) T(o.object); } @@ -224,7 +224,7 @@ public: } } - ResultVal& operator=(const ResultVal& o) { + ResultVal& operator=(const ResultVal& o) noexcept { if (this == &o) { return *this; } @@ -244,6 +244,26 @@ public: return *this; } + ResultVal& operator=(ResultVal&& o) noexcept { + 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. |