diff --git a/include/boost/fusion/container/vector/detail/value_at_impl.hpp b/include/boost/fusion/container/vector/detail/value_at_impl.hpp index 6c8c41fb..a2b9b2f6 100644 --- a/include/boost/fusion/container/vector/detail/value_at_impl.hpp +++ b/include/boost/fusion/container/vector/detail/value_at_impl.hpp @@ -23,7 +23,6 @@ /////////////////////////////////////////////////////////////////////////////// #include #include -#include namespace boost { namespace fusion { @@ -31,8 +30,12 @@ namespace boost { namespace fusion namespace vector_detail { - template - struct vector_data; + template + struct store; + + template + static inline BOOST_FUSION_GPU_ENABLED + U value_at_impl(store const volatile*); } namespace extension @@ -46,8 +49,9 @@ namespace boost { namespace fusion template struct apply { - typedef typename boost::remove_cv::type seq; - typedef typename mpl::identity(boost::declval()))>::type::type type; + typedef + decltype(vector_detail::value_at_impl(boost::declval())) + type; }; }; } diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index 62d2445e..1d6c5f1f 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -133,27 +133,27 @@ namespace boost { namespace fusion BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED store(store const& rhs) - : elem(rhs.get()) + : elem(rhs.elem) {} BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED store& operator=(store const& rhs) { - elem = rhs.get(); + elem = rhs.elem; return *this; } BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED store(store&& rhs) - : elem(static_cast(rhs.get())) + : elem(static_cast(rhs.elem)) {} BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED store& operator=(store&& rhs) { - elem = static_cast(rhs.get()); + elem = static_cast(rhs.elem); return *this; } @@ -168,11 +168,6 @@ namespace boost { namespace fusion : elem(std::forward(rhs)) {} - BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - T & get() { return elem; } - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - T const& get() const { return elem; } - T elem; }; @@ -192,8 +187,7 @@ namespace boost { namespace fusion typedef vector type_sequence; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - vector_data() - {} + BOOST_DEFAULTED_FUNCTION(vector_data(), {}) template < typename Sequence @@ -239,16 +233,16 @@ namespace boost { namespace fusion template static BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - auto at_detail(store* this_) -> decltype(this_->get()) + U& at_detail(store* this_) { - return this_->get(); + return this_->elem; } template static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - auto at_detail(store const* this_) -> decltype(this_->get()) + U const& at_detail(store const* this_) { - return this_->get(); + return this_->elem; } template @@ -264,10 +258,6 @@ namespace boost { namespace fusion { return at_detail(this); } - - template - static BOOST_FUSION_GPU_ENABLED - mpl::identity value_at_impl(store*); }; } // namespace boost::fusion::vector_detail @@ -284,8 +274,7 @@ namespace boost { namespace fusion > base; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - vector() - {} + BOOST_DEFAULTED_FUNCTION(vector(), {}) template < typename... U @@ -306,13 +295,11 @@ namespace boost { namespace fusion template < typename Sequence - , typename Sequence_ = typename remove_reference::type - , typename = typename boost::enable_if_c<( - !is_base_of::value && + , typename = typename boost::enable_if_c< vector_detail::is_longer_sequence< - Sequence_, sizeof...(T) + typename remove_reference::type, sizeof...(T) >::value - )>::type + >::type > BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED vector(Sequence&& seq) 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; } };