diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index 4993e2eb..02ffe514 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -168,9 +168,15 @@ namespace boost { namespace fusion : elem(std::forward(rhs)) {} + using elem_type = T; T elem; }; + // placed outside of vector_data due to GCC < 6 bug + template + static inline BOOST_FUSION_GPU_ENABLED + store store_at_impl(store*); + template struct vector_data; @@ -231,32 +237,23 @@ namespace boost { namespace fusion assign(std::forward(seq), detail::index_sequence()); } - template - static BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - U& at_detail(store* this_) - { - return this_->elem; - } - - template - static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - U const& at_detail(store const* this_) - { - return this_->elem; - } + private: + template + using store_at = decltype(store_at_impl(static_cast(nullptr))); + public: template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - auto at_impl(J) -> decltype(at_detail(&std::declval())) + typename store_at::elem_type& at_impl(J) { - return at_detail(this); + return store_at::elem; } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - auto at_impl(J) const -> decltype(at_detail(&std::declval())) + typename store_at::elem_type const& at_impl(J) const { - return at_detail(this); + return store_at::elem; } }; } // namespace boost::fusion::vector_detail