From 44efe96dfca674a17b45ca53fc77fb69f1e29bf4 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 9 Jul 2019 07:37:37 -0700 Subject: Export of internal Abseil changes. -- 9c4ef32276054fba6a116c01cd4b3fd278f59ece by Andy Soffer : Remove support for unused arbitrary-width output in FastUniformBits. Width should be inferred from the requested return UIntType. PiperOrigin-RevId: 257189319 -- e3326329d02171a301cc3d6ae617ed448472b728 by Abseil Team : Update comments to make clear that absl::Format(std::string *, ...) appends to the provided string. PiperOrigin-RevId: 257058043 -- e2096b06d714fba3ea2c885d670a42efd872765c by Xiaoyi Zhang : Fix compilation error on MSVC 2017. The root cause seems to be a compiler bug in VS 2017 about pack expansion with multiple parameter packs, specifically `MakeVisitationMatrixImpl::Run` is triggering compiler error "error C3528: 'BoundIndices': the number of elements in this pack expansion does not match the number of elements in 'EndIndices'". Work around this issue by using only one parameter pack `CurrIndices` in `MakeVisitationMatrixImpl::Run`. PiperOrigin-RevId: 257040381 -- 9ab75ff27b2513583fffc1233e6568aa96be36f7 by Matt Calabrese : Internal change. PiperOrigin-RevId: 257039041 GitOrigin-RevId: 9c4ef32276054fba6a116c01cd4b3fd278f59ece Change-Id: I5f708bb03aff93948502394a413260af2a8a273b --- absl/types/internal/variant.h | 48 +++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'absl/types') diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h index 85201b4..19de2e1 100644 --- a/absl/types/internal/variant.h +++ b/absl/types/internal/variant.h @@ -204,7 +204,7 @@ template using VisitIndicesResultT = typename VisitIndicesResultImpl::type; template + class BoundIndices> struct MakeVisitationMatrix; template @@ -218,7 +218,7 @@ constexpr ReturnType call_with_indices(FunctionObject&& function) { template struct MakeVisitationMatrix, - BoundIndices...> { + index_sequence> { using ResultType = ReturnType (*)(FunctionObject&&); static constexpr ResultType Run() { return &call_with_indices, } }; +template +struct AppendToIndexSequence; + +template +using AppendToIndexSequenceT = typename AppendToIndexSequence::type; + +template +struct AppendToIndexSequence, J> { + using type = index_sequence; +}; + template + class CurrIndices, class BoundIndices> struct MakeVisitationMatrixImpl; -template -struct MakeVisitationMatrixImpl< - ReturnType, FunctionObject, index_sequence, - index_sequence, BoundIndices...> { +template +struct MakeVisitationMatrixImpl, BoundIndices> { using ResultType = SimpleArray< - typename MakeVisitationMatrix>::ResultType, + typename MakeVisitationMatrix>::ResultType, sizeof...(CurrIndices)>; static constexpr ResultType Run() { - return {{MakeVisitationMatrix, - BoundIndices..., CurrIndices>::Run()...}}; + return {{MakeVisitationMatrix< + ReturnType, FunctionObject, EndIndices, + AppendToIndexSequenceT>::Run()...}}; } }; @@ -251,10 +261,11 @@ template struct MakeVisitationMatrix, - BoundIndices...> - : MakeVisitationMatrixImpl< - ReturnType, FunctionObject, index_sequence, - absl::make_index_sequence, BoundIndices...> {}; + index_sequence> + : MakeVisitationMatrixImpl, + absl::make_index_sequence, + index_sequence> {}; struct UnreachableSwitchCase { template @@ -423,7 +434,8 @@ struct VisitIndicesFallback { static VisitIndicesResultT Run(Op&& op, SizeT... indices) { return AccessSimpleArray( MakeVisitationMatrix, Op, - index_sequence<(EndIndices + 1)...>>::Run(), + index_sequence<(EndIndices + 1)...>, + index_sequence<>>::Run(), (indices + 1)...)(absl::forward(op)); } }; -- cgit v1.2.3