Просмотр исходного кода

ResultVal: Add an rvalue overload of Unwrap()

Yuri Kunde Schlesner 9 лет назад
Родитель
Сommit
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.
     /// Asserts that the result succeeded and returns a reference to it.
-    T& Unwrap() {
+    T& Unwrap() & {
         ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
         ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
         return **this;
         return **this;
     }
     }
 
 
+    T&& Unwrap() && {
+        ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
+        return std::move(**this);
+    }
+
     T&& MoveFrom() {
     T&& MoveFrom() {
         return std::move(Unwrap());
         return std::move(Unwrap());
     }
     }