From 0471a65ca2bb9a8e25538b83a101f9057d2785eb Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Tue, 3 Oct 2017 22:25:03 +0900 Subject: [PATCH] Change fusion::tuple its base class to vector_data. This change aims to improve compile time performance for both of vector and tuple. --- include/boost/fusion/tuple/tuple.hpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/include/boost/fusion/tuple/tuple.hpp b/include/boost/fusion/tuple/tuple.hpp index 07014c6c..16b85511 100644 --- a/include/boost/fusion/tuple/tuple.hpp +++ b/include/boost/fusion/tuple/tuple.hpp @@ -34,13 +34,19 @@ namespace boost { namespace fusion { template - struct tuple : vector + struct tuple + : vector_detail::vector_data< + typename detail::make_index_sequence::type + , T... + > { - typedef vector base_type; + typedef vector_detail::vector_data< + typename detail::make_index_sequence::type + , T... + > base; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - tuple() - : base_type() {} + BOOST_DEFAULTED_FUNCTION(tuple(), {}) template < typename ...U @@ -50,7 +56,7 @@ namespace boost { namespace fusion > BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED tuple(tuple const& other) - : base_type(other) {} + : base(vector_detail::each_elem(), other) {} template < typename ...U @@ -60,7 +66,7 @@ namespace boost { namespace fusion > BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED tuple(tuple&& other) - : base_type(std::move(other)) {} + : base(vector_detail::each_elem(), std::move(other)) {} template < typename ...U @@ -72,23 +78,23 @@ namespace boost { namespace fusion /*BOOST_CONSTEXPR*/ BOOST_FUSION_GPU_ENABLED explicit tuple(U&&... args) - : base_type(std::forward(args)...) {} + : base(vector_detail::each_elem(), std::forward(args)...) {} template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED tuple(std::pair const& other) - : base_type(other.first, other.second) {} + : base(vector_detail::each_elem(), other.first, other.second) {} template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED tuple(std::pair&& other) - : base_type(std::move(other.first), std::move(other.second)) {} + : base(vector_detail::each_elem(), std::move(other.first), std::move(other.second)) {} template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED tuple& operator=(U&& rhs) { - base_type::operator=(std::forward(rhs)); + base::assign_sequence(std::forward(rhs)); return *this; } };