diff --git a/include/boost/fusion/adapted/struct/detail/define_struct.hpp b/include/boost/fusion/adapted/struct/detail/define_struct.hpp index 1b968e38..cb52ddff 100644 --- a/include/boost/fusion/adapted/struct/detail/define_struct.hpp +++ b/include/boost/fusion/adapted/struct/detail/define_struct.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -61,8 +62,26 @@ {} // Use templated version instead. +#define BOOST_FUSION_DEFINE_STRUCT_COPY_ASSIGN_FILLER_I( \ + R, ATTRIBUTE_TUPLE_SIZE, I_, ATTRIBUTE) \ + \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE)= \ + other.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE); + #define BOOST_FUSION_DEFINE_STRUCT_COPY_ASSIGN_OP( \ - ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) + ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \ + \ + BOOST_FUSION_GPU_ENABLED \ + self_type& operator=(self_type const& other) \ + { \ + BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_COPY_ASSIGN_FILLER_I, \ + ATTRIBUTE_TUPLE_SIZE, \ + ATTRIBUTES_SEQ) \ + \ + return *this; \ + } #else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS @@ -124,7 +143,9 @@ #else // BOOST_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) \ + || BOOST_WORKAROUND(BOOST_GCC, < 40500) \ + || BOOST_WORKAROUND(BOOST_MSVC, == 1800) #define BOOST_FUSION_DEFINE_STRUCT_MOVE_CTOR_FILLER_I( \ R, ATTRIBUTE_TUPLE_SIZE, I, ATTRIBUTE) \ @@ -145,37 +166,34 @@ ATTRIBUTES_SEQ) \ {} +#else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS + +#define BOOST_FUSION_DEFINE_STRUCT_MOVE_CTOR( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \ + \ + BOOST_FUSION_GPU_ENABLED NAME(self_type&&) = default; + +#endif // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS + +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) \ + || BOOST_WORKAROUND(BOOST_GCC, < 40600) \ + || BOOST_WORKAROUND(BOOST_MSVC, == 1800) + #define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_FILLER_I( \ R, ATTRIBUTE_TUPLE_SIZE, I_, ATTRIBUTE) \ \ - BOOST_PP_EXPR_IF( \ - I_, \ - typedef typename \ - boost::fusion::result_of::next< \ - BOOST_PP_CAT(I,BOOST_PP_DEC(I_)) \ - >::type \ - BOOST_PP_CAT(I,I_); \ - BOOST_PP_CAT(I,I_) BOOST_PP_CAT(i,I_)= \ - boost::fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(I_))); \ - ) \ - \ BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE)=std::move( \ - boost::fusion::deref(BOOST_PP_CAT(i,I_))); + other.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE)); #define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_OP( \ ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \ \ BOOST_FUSION_GPU_ENABLED \ - self_type& operator=(self_type&& seq) \ + self_type& operator=(self_type&& other) \ { \ - typedef \ - boost::fusion::result_of::begin::type \ - I0; \ - I0 i0=boost::fusion::begin(seq); \ - \ BOOST_PP_SEQ_FOR_EACH_I_R( \ 1, \ - BOOST_FUSION_DEFINE_STRUCT_ASSIGN_FILLER_I, \ + BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_FILLER_I, \ ATTRIBUTE_TUPLE_SIZE, \ ATTRIBUTES_SEQ) \ \ @@ -184,11 +202,6 @@ #else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS -#define BOOST_FUSION_DEFINE_STRUCT_MOVE_CTOR( \ - NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \ - \ - BOOST_FUSION_GPU_ENABLED NAME(self_type&&) = default; - #define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_OP( \ ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \ \ diff --git a/include/boost/fusion/support/detail/and.hpp b/include/boost/fusion/support/detail/and.hpp index 8560f344..1b310dda 100644 --- a/include/boost/fusion/support/detail/and.hpp +++ b/include/boost/fusion/support/detail/and.hpp @@ -20,7 +20,11 @@ namespace boost { namespace fusion { namespace detail { template struct and_impl...> : true_type {}; - + + // This specialization is necessary to avoid MSVC-12 variadics bug. + template + struct and_impl1 : and_impl...> {}; + /* fusion::detail::and_ differs from mpl::and_ in the following ways: - The empty set is valid and returns true - A single element set is valid and returns the identity @@ -29,7 +33,7 @@ namespace boost { namespace fusion { namespace detail { reduces instantations when returning true; the implementation is not recursive. */ template - struct and_ : and_impl...> {}; + struct and_ : and_impl1 {}; }}} #endif // FUSION_AND_07152016_1625