Explorar el Código

ResultVal: Add an rvalue overload of Unwrap()

Yuri Kunde Schlesner hace 9 años
padre
commit
4cb47b0278
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  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());
     }