}
}
-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>
typename std::enable_if<
!std::is_same<typename std::result_of<F()>::type, void>::value,
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)
*
std::rethrow_exception(funcException);
}
- return folly::moveFromTry(result);
+ return std::move(result).value();
}
}
}