Commit 1dd8e387 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Cut moveFromTry

Summary: [Folly] Cut `moveFromTry`. Not necessary, and is even longer than `std::move`.

Reviewed By: WillerZ, ericniebler

Differential Revision: D5478450

fbshipit-source-id: ecd01cb1bcd435e49268a76dd558e57ba8dd9b9e
parent 12b5fff0
...@@ -133,15 +133,6 @@ void Try<void>::throwIfFailed() const { ...@@ -133,15 +133,6 @@ void Try<void>::throwIfFailed() const {
} }
} }
template <typename T>
inline T moveFromTry(Try<T>& t) {
return std::move(t.value());
}
inline void moveFromTry(Try<void>& t) {
return t.value();
}
template <typename F> template <typename F>
typename std::enable_if< typename std::enable_if<
!std::is_same<typename std::result_of<F()>::type, void>::value, !std::is_same<typename std::result_of<F()>::type, void>::value,
......
...@@ -478,23 +478,6 @@ class Try<void> { ...@@ -478,23 +478,6 @@ class Try<void> {
exception_wrapper e_; exception_wrapper e_;
}; };
/*
* Extracts value from try and returns it. Throws if try contained an exception.
*
* @param t Try to extract value from
*
* @returns value contained in t
*/
template <typename T>
T moveFromTry(Try<T>& t);
/*
* Throws if try contained an exception.
*
* @param t Try to move from
*/
void moveFromTry(Try<void>& t);
/* /*
* @param f a function to execute and capture the result of (value or exception) * @param f a function to execute and capture the result of (value or exception)
* *
......
...@@ -110,7 +110,7 @@ typename Promise<T, BatonT>::value_type Promise<T, BatonT>::await(F&& func) { ...@@ -110,7 +110,7 @@ typename Promise<T, BatonT>::value_type Promise<T, BatonT>::await(F&& func) {
std::rethrow_exception(funcException); std::rethrow_exception(funcException);
} }
return folly::moveFromTry(result); return std::move(result).value();
} }
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment