ResultVal: Add an rvalue overload of Unwrap()

This commit is contained in:
Yuri Kunde Schlesner 2017-06-18 18:49:46 -07:00
parent 2f5b8ebc73
commit ec6a30b8bb

View file

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