Commit 201b8040 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Separate try and value versions of then to make deprecation and removal easier.

Summary: Separates variants of Future::then that take differently parameterised lambdas. This will allow separately deprecating and then deleting them without having to solve all at once.

Reviewed By: yfeldblum

Differential Revision: D9512097

fbshipit-source-id: 1b6c0946f0fa38cf8427c66fe1bef47315875e58
parent f0ac6ddd
......@@ -1152,8 +1152,29 @@ class Future : private futures::detail::FutureBase<T> {
/// - Calling code should act as if `valid() == false`,
/// i.e., as if `*this` was moved into RESULT.
/// - `RESULT.valid() == true`
/// NOTE: All three of these variations are deprecated and deprecation
/// attributes will be added in the near future. Please prefer thenValue,
/// thenTry or thenError rather than then and onError as they avoid ambiguity
/// when using polymorphic lambdas.
template <typename F, typename R = futures::detail::callableResult<T, F>>
typename R::Return then(F&& func) && {
typename std::enable_if<
!is_invocable<F>::value && is_invocable<F, T&&>::value,
typename R::Return>::type
then(F&& func) && {
return std::move(*this).thenValue(std::forward<F>(func));
}
template <typename F, typename R = futures::detail::callableResult<T, F>>
typename std::enable_if<
!is_invocable<F, T&&>::value && !is_invocable<F>::value,
typename R::Return>::type
then(F&& func) && {
return std::move(*this).thenTry(std::forward<F>(func));
}
template <typename F, typename R = futures::detail::callableResult<T, F>>
typename std::enable_if<is_invocable<F>::value, typename R::Return>::type
then(F&& func) && {
return this->template thenImplementation<F, R>(
std::forward<F>(func), typename R::Arg());
}
......
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