ResultVal: Add an rvalue overload of Unwrap()

master
Yuri Kunde Schlesner 2017-06-18 18:49:46 +07:00
parent d0888f8548
commit 4cb47b0278
1 changed files with 6 additions and 1 deletions

@ -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());
}