Chromium Code Reviews| Index: base/bind_helpers.h |
| diff --git a/base/bind_helpers.h b/base/bind_helpers.h |
| index dd16fec758a89832b580c232e29f39343b4d5067..bd3f3a58bcd3f2352324b5a1bf81a0b6459ed2cf 100644 |
| --- a/base/bind_helpers.h |
| +++ b/base/bind_helpers.h |
| @@ -462,11 +462,11 @@ T Unwrap(PassedWrapper<T>& o) { |
| // |
| // The first argument should be the type of the object that will be received by |
| // the method. |
| -template <bool IsMethod, typename... Args> |
| +template <bool IsMethod, typename ArgsTuple> |
|
dcheng
2016/06/27 07:57:22
Just for my own understanding, why did this templa
tzik
2016/06/27 08:43:11
That is for utility for the caller, Invoker::RunIm
|
| struct IsWeakMethod : std::false_type {}; |
| template <typename T, typename... Args> |
| -struct IsWeakMethod<true, T, Args...> : IsWeakReceiver<T> {}; |
| +struct IsWeakMethod<true, std::tuple<T, Args...>> : IsWeakReceiver<T> {}; |
| // Packs a list of types to hold them in a single type. |
| template <typename... Types> |
| @@ -549,19 +549,25 @@ struct MakeFunctionTypeImpl<R, TypeList<Args...>> { |
| template <typename R, typename ArgList> |
| using MakeFunctionType = typename MakeFunctionTypeImpl<R, ArgList>::Type; |
| -// Used for ExtractArgs. |
| +// Used for ExtractArgs and ExtractReturnType. |
| template <typename Signature> |
| struct ExtractArgsImpl; |
| template <typename R, typename... Args> |
| struct ExtractArgsImpl<R(Args...)> { |
| - using Type = TypeList<Args...>; |
| + using ReturnType = R; |
| + using ArgsList = TypeList<Args...>; |
| }; |
| // A type-level function that extracts function arguments into a TypeList. |
| // E.g. ExtractArgs<R(A, B, C)> is evaluated to TypeList<A, B, C>. |
| template <typename Signature> |
| -using ExtractArgs = typename ExtractArgsImpl<Signature>::Type; |
| +using ExtractArgs = typename ExtractArgsImpl<Signature>::ArgsList; |
| + |
| +// A type-level function that extracts the return type of a function. |
| +// E.g. ExtractReturnType<R(A, B, C)> is evaluated to R. |
| +template <typename Signature> |
| +using ExtractReturnType = typename ExtractArgsImpl<Signature>::ReturnType; |
| } // namespace internal |