fixed move assignment operator for expected (#4906)

This commit is contained in:
Max Kareta 2018-08-14 11:41:58 +01:00 committed by GitHub
parent 82ee1b9a43
commit 5ef2375a17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,17 @@ class Expected final {
Expected(const Expected&) = delete;
Expected(ErrorBase* error) = delete;
Expected& operator=(Expected&& other) = default;
Expected& operator=(Expected&& other) {
if (this != &other) {
errorChecked_.verify("Error was not checked");
object_ = std::move(other.object_);
errorChecked_ = other.errorChecked_;
other.errorChecked_ = true;
}
return *this;
}
Expected& operator=(const Expected& other) = delete;
~Expected() {