forked from suyu/suyu
hle/result: Add move assignment operator in ResultVal
ResultVal was missing a move assignment operator, add it.
This commit is contained in:
parent
40c8a8c627
commit
189927c237
1 changed files with 20 additions and 0 deletions
|
@ -244,6 +244,26 @@ public:
|
||||||
return *this;
|
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
|
* Replaces the current result with a new constructed result value in-place. The code must not
|
||||||
* be an error code.
|
* be an error code.
|
||||||
|
|
Loading…
Reference in a new issue