From: Yedidya Feldblum Date: Mon, 3 Jul 2017 20:20:29 +0000 (-0700) Subject: For futures::retrying, detect policy type using std::result_of X-Git-Tag: v2017.07.10.00~19 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e81cc5a08625224488b893d6509d030cf56bf45a;p=folly.git For futures::retrying, detect policy type using std::result_of Summary: [Folly] For `futures::retrying`, detect policy type using `std::result_of`. `FOLLY_CREATE_HAS_MEMBER_FN_TRAITS` does not work in all cases. For example, it does not work with inherited members. And it is not really what we want, anyway, which is to dispatch based on the result type of invoking the policy with a particular set of arguments. We can do that more directly using `std::result_of`. And if we did not have `std::result_of`, then we could do that with SFINAE directly. Reviewed By: WillerZ Differential Revision: D5361808 fbshipit-source-id: 23f969dfd6dbaaa944dc2288e70c3ea11d3398f0 --- diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index e326be0b..48083922 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -1251,14 +1250,9 @@ struct retrying_policy_fut_tag {}; template struct retrying_policy_traits { - using ew = exception_wrapper; - FOLLY_CREATE_HAS_MEMBER_FN_TRAITS(has_op_call, operator()); - template - using has_op = typename std::integral_constant::value || - has_op_call::value>; - using is_raw = has_op; - using is_fut = has_op>; + using result = std::result_of_t; + using is_raw = std::is_same; + using is_fut = std::is_same>; using tag = typename std::conditional< is_raw::value, retrying_policy_raw_tag, typename std::conditional< is_fut::value, retrying_policy_fut_tag, void>::type>::type;