From: Christopher Dykes Date: Mon, 15 Aug 2016 22:56:35 +0000 (-0700) Subject: Fix applyTuple to work under MSVC again X-Git-Tag: v2016.08.22.00~34 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=74d1af87831f9df2b5cb9d104db1d0e2edab591e;p=folly.git Fix applyTuple to work under MSVC again Summary: Because MSVC didn't like the new version used to add support for multiple tuples. This also switches to std::index_sequence rather than our own home-grown version. Reviewed By: yfeldblum Differential Revision: D3706506 fbshipit-source-id: 724c995fe2671d21f78cd7ffa4b19ea1b278c308 --- diff --git a/folly/ApplyTuple.h b/folly/ApplyTuple.h index 0288f567..b2298776 100644 --- a/folly/ApplyTuple.h +++ b/folly/ApplyTuple.h @@ -55,9 +55,14 @@ inline constexpr std::size_t sum(std::size_t v1, Args... vs) { return v1 + sum(vs...); } -template -using MakeIndexSequenceFromTuple = MakeIndexSequence::type>::value...)>; +template +struct TupleSizeSum { + static constexpr auto value = sum(std::tuple_size::value...); +}; + +template +using MakeIndexSequenceFromTuple = MakeIndexSequence< + TupleSizeSum::type...>::value>; // This is to allow using this with pointers to member functions, // where the first argument in the tuple will be the this pointer.