Chromium Code Reviews| Index: base/tuple.h |
| diff --git a/base/tuple.h b/base/tuple.h |
| index 8898fe0d2e0af00bae59de17225243bb27148792..b9cd791eff282957bc16cd9077ad8d597d43ed78 100644 |
| --- a/base/tuple.h |
| +++ b/base/tuple.h |
| @@ -228,6 +228,40 @@ inline void DispatchToFunction(Function function, const Tuple<Ts...>& arg) { |
| template <typename ObjT, |
| typename Method, |
| + typename P, |
| + typename... InTs, |
| + typename... OutTs, |
| + size_t... InNs, |
| + size_t... OutNs> |
| +inline void DispatchToMethodImpl(const ObjT& obj, |
| + Method method, |
| + P* parameter, |
| + const Tuple<InTs...>& in, |
| + Tuple<OutTs...>* out, |
| + IndexSequence<InNs...>, |
| + IndexSequence<OutNs...>) { |
| + (obj->*method)(parameter, internal::Unwrap(get<InNs>(in))..., |
| + &get<OutNs>(*out)...); |
| +} |
| + |
| +template <typename ObjT, |
| + typename P, |
| + typename... Args, |
| + typename... InTs, |
| + typename... OutTs, |
| + typename std::enable_if<!std::is_void<P>::value>::type* = nullptr> |
|
danakj
2016/03/03 21:00:28
I know you're working around msvc bugs but I don't
|
| +void DispatchToMethod(ObjT* obj, |
| + void (ObjT::*method)(P*, Args...), |
| + P* parameter, |
| + const base::Tuple<InTs...>& tuple, |
| + base::Tuple<OutTs...>* out) { |
| + DispatchToMethodImpl(obj, method, parameter, tuple, out, |
| + MakeIndexSequence<sizeof...(InTs)>(), |
| + MakeIndexSequence<sizeof...(OutTs)>()); |
| +} |
| + |
| +template <typename ObjT, |
| + typename Method, |
| typename... InTs, |
| typename... OutTs, |
| size_t... InNs, |
| @@ -241,9 +275,14 @@ inline void DispatchToMethodImpl(const ObjT& obj, |
| (obj->*method)(internal::Unwrap(get<InNs>(in))..., &get<OutNs>(*out)...); |
| } |
| -template <typename ObjT, typename Method, typename... InTs, typename... OutTs> |
| +template <typename ObjT, |
| + typename Method, |
| + typename P, |
| + typename... InTs, |
| + typename... OutTs> |
| inline void DispatchToMethod(const ObjT& obj, |
| Method method, |
| + P* parameter, |
| const Tuple<InTs...>& in, |
| Tuple<OutTs...>* out) { |
| DispatchToMethodImpl(obj, method, in, out, |