فهرست منبع

ResultVal: Add an rvalue overload of Unwrap()

Yuri Kunde Schlesner 9 سال پیش
والد
کامیت
4cb47b0278
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      src/core/hle/result.h

+ 6 - 1
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());
     }