Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

ResultVal: Add an rvalue overload of Unwrap()

Yuri Kunde Schlesnerec6a30b8bbb8
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index 5f2cdbb963..55bd8d22fc 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -388,11 +388,16 @@ public:
}
/// Asserts that the result succeeded and returns a reference to it.
- T& Unwrap() {
+ T& Unwrap() & {
ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
return **this;
}
+ T&& Unwrap() && {
+ ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
+ return std::move(**this);
+ }
+
T&& MoveFrom() {
return std::move(Unwrap());
}